Пример #1
0
 def set_active(self):
     self.store.clear()
     configuration = Configuration()
     calendars_options = configuration.get('calendars')
     if os.path.exists(comun.TOKEN_FILE):
         if self.googlecalendar is not None:
             calendars = self.googlecalendar.calendars.values()
         else:
             gca = GoogleCalendar(token_file=comun.TOKEN_FILE)
             gca.read()
             calendars = gca.get_calendars().values()
         for calendar in calendars:
             calendar_options = get_calendar_from_options(
                 configuration.get('calendars'), calendar['id'])
             if calendar_options:
                 background_color = calendar_options['background']
                 foreground_color = calendar_options['foreground']
                 visible = calendar_options['visible']
                 if 'name' in calendar_options.keys():
                     calendar_name = calendar_options['name']
                 else:
                     calendar_name = calendar['summary']
             else:
                 background_color = tohex()
                 foreground_color = contraste(background_color)
                 visible = True
                 calendar_name = calendar['summary']
             self.store.append([
                 calendar['summary'], background_color, foreground_color,
                 calendar['id'], visible, calendar_name
             ])
Пример #2
0
 def set_active(self):
     configuration = Configuration()
     self.options['time'].set_value(configuration.get('time'))
     self.options['theme'].set_active(configuration.get('theme') == 'light')
     filestart = os.path.join(
         os.getenv("HOME"),
         ".config/autostart/calendar-indicator-autostart.desktop")
     self.options['autostart'].set_active(os.path.exists(filestart))
Пример #3
0
 def load_preferences(self):
     configuration = Configuration()
     self.show_disks.set_active(configuration.get('show-hdd'))
     self.show_net.set_active(configuration.get('show-net'))
     filestart = os.path.join(
         os.getenv("HOME"),
         ".config/autostart/indicator-usb-autostart.desktop")
     self.autostart.set_active(os.path.exists(filestart))
	def load_preferences(self):
		configuration = Configuration()
		self.time = configuration.get('time')
		self.theme = configuration.get('theme')
		self.calendars = configuration.get('calendars')
		self.visible_calendars = []
		for calendar in self.calendars:
			if calendar['visible']:
				self.visible_calendars.append(calendar['id'])
 def load_preferences(self):
     configuration = Configuration()
     self.time = configuration.get('time')
     self.theme = configuration.get('theme')
     self.calendars = configuration.get('calendars')
     self.visible_calendars = []
     for calendar in self.calendars:
         if calendar['visible']:
             self.visible_calendars.append(calendar['id'])
Пример #6
0
 def fromConfiguration(cls):
     configuration = Configuration()
     hostname = configuration.get('hostname')
     port = configuration.get('port')
     username = configuration.get('username')
     password = configuration.get('password')
     by_password = configuration.get('credentials_by_password')
     keyfilename = configuration.get('keyfilename')
     if by_password:
         return RaspberryClient(hostname, port, username, password)
     return RaspberryClient(hostname, port, username, keyfile=keyfilename)
 def read_preferences(self):
     configuration = Configuration()
     self.first_time = configuration.get('first-time')
     self.version = configuration.get('version')
     self.theme = configuration.get('theme')
     self.monitor_clipboard = configuration.get('monitor-clipboard')
     self.downloaddir = configuration.get('download-dir')
     if self.monitor_clipboard:
         self.menu_capture.set_label(_('Not capture'))
         self.indicator.set_icon(comun.STATUS_ICON[self.theme])
     else:
         self.menu_capture.set_label(_('Capture'))
         self.indicator.set_icon(comun.DISABLED_ICON[self.theme])
Пример #8
0
 def start(self):
     configuration = Configuration()
     if configuration.get('webcam-show'):
         self.wcw = WebcamWidget()
         self.wcw.connect('preferences', self.on_preferences)
         self.wcw.show()
     cameras = configuration.get('cameras')
     if len(cameras) > 0:
         for acamera in cameras:
             if 'on' not in acamera.keys() or acamera['on'] is True:
                 cm = CameraWidget(acamera)
                 cm.connect('preferences', self.on_preferences)
                 cm.show()
                 cm.start_updater()
                 self.cameras.append(cm)
Пример #9
0
 def start(self):
     configuration = Configuration()
     if configuration.get('webcam-show'):
         self.wcw = WebcamWidget()
         self.wcw.connect('preferences', self.on_preferences)
         self.wcw.show()
     cameras = configuration.get('cameras')
     if len(cameras) > 0:
         for acamera in cameras:
             if 'on' not in acamera.keys() or acamera['on'] is True:
                 cm = CameraWidget(acamera)
                 cm.connect('preferences', self.on_preferences)
                 cm.show()
                 cm.start_updater()
                 self.cameras.append(cm)
Пример #10
0
    def start(self):
        configuration = Configuration()
        preferences = configuration.get('preferences')

        https_protocol = preferences['https_protocol']
        base_url = preferences['base_url']
        application_name = preferences['application_name']
        application_token = preferences['application_token']
        client_token = preferences['client_token']

        if base_url and application_name and application_token \
                and client_token:
            self.gotify_client = GotifyClient(https_protocol,
                                              base_url,
                                              application_name,
                                              application_token,
                                              client_token,
                                              self.on_message,
                                              True)
            self.gotify_client.set_icon_callback(self.set_icon)
            self.gotify_client.start()
            self.menu_toggle_service.set_label(_('Stop service'))
            return True
        message = _('Please configure Gotify Indicator')
        icon = os.path.join(config.ICONDIR, 'gotify-indicator.svg')
        self.notification.update('Gofify-Indictator',
                                 message,
                                 icon)
        self.notification.show()
Пример #11
0
 def save(self):
     configuration = Configuration()
     preferences = configuration.get('preferences')
     preferences['theme-light'] = self.theme_light.get_active()
     preferences['todos'] = int(self.todos.get_value())
     preferences['todo-file'] = self.todo_file.get_file().get_path()
     preferences['projects'] = self.projects.get_items()
     preferences['contexts'] = self.contexts.get_items()
     preferences['tags'] = self.tags.get_items()
     preferences['hide-completed'] = self.hide_completed.get_active()
     preferences['filter-projects'] = self.filter_projects.get_active()
     preferences['keybindings'] = [
         {
             'name': 'new_task',
             'keybind': self.new_task_keybinding.get_text()
         },
         {
             'name': 'show_tasks',
             'keybind': self.show_tasks_keybinding.get_text()
         },
     ]
     configuration.set('preferences', preferences)
     configuration.save()
     autostart_file = 'todotxt-indicator-autostart.desktop'
     autostart_file = os.path.join(os.getenv('HOME'), '.config/autostart',
                                   autostart_file)
     if self.autostart.get_active():
         if not os.path.exists(os.path.dirname(autostart_file)):
             os.makedirs(os.path.dirname(autostart_file))
         shutil.copyfile(config.AUTOSTART, autostart_file)
     else:
         if os.path.exists(autostart_file):
             os.remove(autostart_file)
Пример #12
0
    def load(self):
        configuration = Configuration()
        preferences = configuration.get('preferences')
        projects = preferences['projects']
        contexts = preferences['contexts']
        project_store = self.project.get_model()
        project_store.clear()
        project_store.append(['-', '-'])
        if projects:
            for project in projects:
                project_store.append([project, project])
        self.project.set_model(project_store)
        context_store = self.context.get_model()
        context_store.clear()
        context_store.append(['-', '-'])
        if contexts:
            for context in contexts:
                context_store.append([context, context])
        self.context.set_model(context_store)
        select_value_in_combo(self.priority, -1)
        select_value_in_combo(self.project, '-')
        select_value_in_combo(self.context, '-')

        todo_file = Path(os.path.expanduser(preferences['todo-file']))
        if not todo_file.exists():
            if not todo_file.parent.exists():
                os.makedirs(todo_file.parent)
            todo_file.touch()
        self.todo_file = todo_file.as_posix()
        self.load_todos()
Пример #13
0
 def __init__(self, ):
     configuration = Configuration()
     preferences = configuration.get("preferences")
     parent_folder = Path(os.path.expanduser(
         preferences["todo-file"])).parent.as_posix()
     self.todo_histoy = parent_folder + os.sep + "todo.history.txt"
     self.export_file = parent_folder + os.sep + "export.csv"
Пример #14
0
    def show_statistics(self, widget):
        widget.set_sensitive(False)

        if self.is_monitoring and self.monitor is not None:
            self.monitor.save()

        title = _('Habits')
        subtitle = _('Mouse and keyboard')
        configuration = Configuration()
        stats = configuration.get('stats')
        days = []
        distance = []
        clics = []
        keys = []
        for day in stats:
            days.append(day)
            if 'distance' in stats[day].keys():
                distance.append(stats[day]['distance']/1000.0)
            else:
                distance.append(0)
            if 'clics' in stats[day].keys():
                clics.append(stats[day]['clics'])
            else:
                clics.append(0)
            if 'keys' in stats[day].keys():
                keys.append(stats[day]['keys'])
            else:
                keys.append(0)
        graph = Graph(title, subtitle, days, distance, clics, keys)
        graph.run()
        graph.destroy()
        widget.set_sensitive(True)
    def save(self):
        configuration = Configuration()
        preferences = configuration.get('preferences')

        preferences['https_protocol'] = self.https_protocol.get_active()
        preferences['base_url'] = self.base_url.get_text()
        preferences['application_name'] = self.application_name.get_text()
        preferences['application_token'] = self.application_token.get_text()
        preferences['client_token'] = self.client_token.get_text()

        preferences['theme-light'] = self.theme_light.get_active()

        configuration.set('preferences', preferences)
        configuration.save()

        autostart_file = 'gotify-indicator-autostart.desktop'
        autostart_file = os.path.join(os.getenv('HOME'), '.config/autostart',
                                      autostart_file)
        if self.autostart.get_active():
            if not os.path.exists(os.path.dirname(autostart_file)):
                os.makedirs(os.path.dirname(autostart_file))
            shutil.copyfile(config.AUTOSTART, autostart_file)
        else:
            if os.path.exists(autostart_file):
                os.remove(autostart_file)
Пример #16
0
    def save(self):
        configuration = Configuration()
        preferences = configuration.get('preferences')
        preferences['theme-light'] = self.theme_light.get_active()
        preferences['start-actived'] = self.start_actived.get_active()
        preferences['units'] = get_selected_value_in_combo(self.units)

        preferences['distance-color'] = convert_rgb2hex(
            self.distance_color.get_rgba())
        preferences['clics-color'] = convert_rgb2hex(
            self.clics_color.get_rgba())
        preferences['keys-color'] = convert_rgb2hex(
            self.keys_color.get_rgba())

        configuration.set('preferences', preferences)
        configuration.save()
        autostart_file = 'habits-autostart.desktop'
        autostart_file = os.path.join(
            os.getenv('HOME'), '.config/autostart', autostart_file)
        if self.autostart.get_active():
            if not os.path.exists(os.path.dirname(autostart_file)):
                os.makedirs(os.path.dirname(autostart_file))
            shutil.copyfile(config.AUTOSTART, autostart_file)
        else:
            if os.path.exists(autostart_file):
                os.remove(autostart_file)
Пример #17
0
 def load_preferences(self):
     configuration = Configuration()
     x = configuration.get('webcam-x')
     y = configuration.get('webcam-y')
     self.is_above = configuration.get('webcam-onwidgettop')
     self.showintaskbar = configuration.get('webcam-showintaskbar')
     self.onalldesktop = configuration.get('webcam-onalldesktop')
     self.is_on = configuration.get('webcam-on')
     self.set_keep_above(self.is_above)
     self.is_set_keep_above(self.is_above)
     self.set_keep_below(not self.is_above)
     if self.onalldesktop:
         self.stick()
     else:
         self.unstick()
     self.move(x, y)
Пример #18
0
 def save(self):
     configuration = Configuration()
     stats = configuration.get('stats')
     for day in self.data.keys():
         stats[day] = self.data[day]
     configuration.set('stats', stats)
     configuration.save()
Пример #19
0
class BaseGraph(BaseDialog):
    """
    Class that allows the visualization of graphs with highcharts.js


    To implement your own graphs, simply override the get_data method or use get_keys and get_values
    that are related to each other
    """

    def __init__(self, title='', subtitle=''):
        self.title = _(title)
        self.configuration = Configuration()
        preferences = self.configuration.get('preferences')
        todo_file = Path(os.path.expanduser(preferences['todo-file']))
        self.todo_file = todo_file.as_posix()
        self.subtitle = _(subtitle)
        BaseDialog.__init__(self, title, None, ok_button=False,
                            cancel_button=False)

    def init_ui(self):
        BaseDialog.init_ui(self)

        self.scrolledwindow1 = Gtk.ScrolledWindow()
        self.scrolledwindow1.set_policy(Gtk.PolicyType.AUTOMATIC,
                                        Gtk.PolicyType.AUTOMATIC)
        self.grid.attach(self.scrolledwindow1, 0, 0, 1, 1)

        self.viewer = WebKit2.WebView()
        self.scrolledwindow1.add(self.viewer)
        self.scrolledwindow1.set_size_request(1300, 600)
        self.viewer.load_uri('file://' + config.HTML_GRAPH)
        self.viewer.connect('load-changed', self.load_changed)
        self.set_focus(self.viewer)

    def load_changed(self, widget, load_event):
        if load_event == WebKit2.LoadEvent.FINISHED:
            self.send_data()

    def send_data(self):
        message = 'draw_graph("{}", "{}", {});'.format(self.title,
                                                       self.subtitle,
                                                       self.get_data())

        self.viewer.run_javascript(message, None, None, None)

    def get_data(self, ):
        plaindata = self.get_plaindata()
        keys = self.get_keys(plaindata)
        values = self.get_values(keys, plaindata)
        return {'keys': keys, 'values': values}

    def get_plaindata(self, ):
        return todotxtio.from_file(self.todo_file)

    def get_keys(self, plaindata):
        return super().get_keys(plaindata)

    def get_values(self, keys, plaindata):
        return super().get_values(keys, plaindata)
	def read_preferences(self):
		error = True
		while error:
			try:
				configuration = Configuration()
				self.tasklist_id = configuration.get('tasklist_id')
				self.theme = configuration.get('theme')
				error = False
			except Exception as e:
				print(e)
				error = True
				p = Preferences()
				if p.run() == Gtk.ResponseType.ACCEPT:
					p.save_preferences()
				else:
					exit(1)
				p.destroy()
Пример #21
0
 def check_status_from_resume(self):
     configuration = Configuration()
     self.touchpad_enabled = configuration.get('touchpad_enabled')
     if self.touchpad_enabled != self.touchpad.are_all_touchpad_enabled():
         self.set_touch_enabled(self.touchpad_enabled)
     if self.on_mouse_plugged and not self.touchpad_enabled:
         if not is_mouse_plugged():
             self.set_touch_enabled(True)
Пример #22
0
    def load_preferences(self):
        configuration = Configuration()
        preferences = configuration.get('preferences')
        self.theme_light = preferences['theme-light']
        self.application_name = preferences['application_name']

        self.stop()
        self.start()
Пример #23
0
 def __init__(self, title=""):
     configuration = Configuration()
     preferences = configuration.get("preferences")
     self.todo_histoy = (Path(os.path.expanduser(
         preferences["todo-file"])).parent.as_posix() + os.sep +
                         "todo.history.txt")
     BaseGraph.__init__(self, title, "")
     self.subtitle = ""
Пример #24
0
	def check_status_from_resume(self):
		configuration = Configuration()
		self.touchpad_enabled = configuration.get('touchpad_enabled')
		if self.touchpad_enabled != self.touchpad.are_all_touchpad_enabled():
			self.set_touch_enabled(self.touchpad_enabled)
		if self.on_mouse_plugged and not self.touchpad_enabled:
			if not is_mouse_plugged():
				self.set_touch_enabled(True)
Пример #25
0
 def getNotificationSound(self):
     path = os.path.join(config.SOUNDDIR, 'default.mp3')
     configuration = Configuration()
     preferences = configuration.get('preferences')
     custom_path = preferences['notification_sound']
     if custom_path:
         path = custom_path
     return AudioSegment.from_mp3(path)
 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.spinbutton0.set_value(configuration.get('number_of_pomodoros'))
     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')
Пример #27
0
 def __init__(self):
     configuration = Configuration()
     preferences = configuration.get("preferences")
     self.todo_histoy = (Path(os.path.expanduser(
         preferences["todo-file"])).parent.as_posix() + os.sep +
                         "todo.history.txt")
     todo_histoy_path = Path(self.todo_histoy)
     if not todo_histoy_path.exists():
         todo_histoy_path.touch()
 def load_preferences(self):
     self.switch1.set_active(os.path.exists(comun.TOKEN_FILE))
     configuration = Configuration()
     time = configuration.get('time')
     theme = configuration.get('theme')
     calendars_options = configuration.get('calendars')
     self.spin3.set_value(time)
     if os.path.exists(
             os.path.join(
                 os.getenv("HOME"),
                 ".config/autostart/calendar-indicator-autostart.desktop")):
         self.switch4.set_active(True)
     if theme == 'light':
         self.switch5.set_active(True)
     else:
         self.switch5.set_active(False)
     if os.path.exists(comun.TOKEN_FILE):
         if self.googlecalendar is not None:
             calendars = self.googlecalendar.calendars.values()
         else:
             gca = GoogleCalendar(token_file=comun.TOKEN_FILE)
             gca.read()
             calendars = gca.get_calendars().values()
         self.store.clear()
         for calendar in calendars:
             calendar_options = get_calendar_from_options(
                 configuration.get('calendars'), calendar['id'])
             if calendar_options:
                 background_color = calendar_options['background']
                 foreground_color = calendar_options['foreground']
                 visible = calendar_options['visible']
                 if 'name' in calendar_options.keys():
                     calendar_name = calendar_options['name']
                 else:
                     calendar_name = calendar['summary']
             else:
                 background_color = tohex(random.randint(0, 16777215))
                 foreground_color = tohex(random.randint(0, 16777215))
                 visible = True
                 calendar_name = calendar['summary']
             self.store.append([
                 calendar['summary'], background_color, foreground_color,
                 calendar['id'], visible, calendar_name
             ])
Пример #29
0
 def save_preferences(self):
     configuration = Configuration()
     cameras = configuration.get('cameras')
     create_or_remove_autostart(self.switch1.get_active())
     if self.switch2.get_active() is True:
         configuration.set('theme', 'light')
     else:
         configuration.set('theme', 'dark')
     configuration.set('webcam-show', self.webcam_show.get_active())
     configuration.set('webcam-onwidgettop',
                       self.webcam_onwidgettop.get_active())
     configuration.set('webcam-showintaskbar',
                       self.webcam_showintaskbar.get_active())
     configuration.set('webcam-onalldesktop',
                       self.webcam_onalldesktop.get_active())
     new_cameras = []
     for awidget in self.widgets:
         exists = False
         if len(awidget['url'].get_text()) > 0:
             for old_camera in cameras:
                 if old_camera['url'] == awidget['url'].get_text():
                     exists = True
                     old_camera['scale'] = awidget['scale'].get_value()
                     old_camera['onwidgettop'] =\
                         awidget['onwidgettop'].get_active()
                     old_camera['showintaskbar'] =\
                         awidget['showintaskbar'].get_active()
                     old_camera['onalldesktop'] =\
                         awidget['onalldesktop'].get_active()
                     old_camera['refresh-time'] =\
                         awidget['refresh-time'].get_value()
                     old_camera['on'] =\
                         awidget['on'].get_active()
                     new_cameras.append(old_camera)
             if exists is False:
                 new_camera = {}
                 new_camera['url'] = awidget['url'].get_text()
                 if not new_camera['url'].startswith('http://') and\
                         not new_camera['url'].startswith('https://'):
                     new_camera['url'] = 'http://' + new_camera['url']
                 new_camera['scale'] = awidget['scale'].get_value()
                 new_camera['x'] = 100
                 new_camera['y'] = 100
                 new_camera['onwidgettop'] = \
                     awidget['onwidgettop'].get_active()
                 new_camera['showintaskbar'] = \
                     awidget['showintaskbar'].get_active()
                 new_camera['onalldesktop'] = \
                     awidget['onalldesktop'].get_active()
                 new_camera['refresh-time'] = \
                     awidget['refresh-time'].get_value()
                 new_camera['on'] = \
                     awidget['on'].get_active()
                 new_cameras.append(new_camera)
     configuration.set('cameras', new_cameras)
     configuration.save()
Пример #30
0
 def save_preferences(self):
     configuration = Configuration()
     cameras = configuration.get('cameras')
     create_or_remove_autostart(self.switch1.get_active())
     if self.switch2.get_active() is True:
         configuration.set('theme', 'light')
     else:
         configuration.set('theme', 'dark')
     configuration.set('webcam-show', self.webcam_show.get_active())
     configuration.set('webcam-onwidgettop',
                       self.webcam_onwidgettop.get_active())
     configuration.set('webcam-showintaskbar',
                       self.webcam_showintaskbar.get_active())
     configuration.set('webcam-onalldesktop',
                       self.webcam_onalldesktop.get_active())
     new_cameras = []
     for awidget in self.widgets:
         exists = False
         if len(awidget['url'].get_text()) > 0:
             for old_camera in cameras:
                 if old_camera['url'] == awidget['url'].get_text():
                     exists = True
                     old_camera['scale'] = awidget['scale'].get_value()
                     old_camera['onwidgettop'] =\
                         awidget['onwidgettop'].get_active()
                     old_camera['showintaskbar'] =\
                         awidget['showintaskbar'].get_active()
                     old_camera['onalldesktop'] =\
                         awidget['onalldesktop'].get_active()
                     old_camera['refresh-time'] =\
                         awidget['refresh-time'].get_value()
                     old_camera['on'] =\
                         awidget['on'].get_active()
                     new_cameras.append(old_camera)
             if exists is False:
                 new_camera = {}
                 new_camera['url'] = awidget['url'].get_text()
                 if not new_camera['url'].startswith('http://') and\
                         not new_camera['url'].startswith('https://'):
                     new_camera['url'] = 'http://' + new_camera['url']
                 new_camera['scale'] = awidget['scale'].get_value()
                 new_camera['x'] = 100
                 new_camera['y'] = 100
                 new_camera['onwidgettop'] = \
                     awidget['onwidgettop'].get_active()
                 new_camera['showintaskbar'] = \
                     awidget['showintaskbar'].get_active()
                 new_camera['onalldesktop'] = \
                     awidget['onalldesktop'].get_active()
                 new_camera['refresh-time'] = \
                     awidget['refresh-time'].get_value()
                 new_camera['on'] = \
                     awidget['on'].get_active()
                 new_cameras.append(new_camera)
     configuration.set('cameras', new_cameras)
     configuration.save()
Пример #31
0
 def load_preferences(self):
     configuration = Configuration()
     model = self.treeview.get_model()
     model.clear()
     folders = configuration.get('folders')
     for folder in folders:
         scan = folder['scan']
         recursive = folder['recursive']
         folder_name = folder['name']
         model.append([scan, recursive, folder_name])
Пример #32
0
 def on_button_on_clicked(self, widget):
     configuration = Configuration()
     x, y = self.get_position()
     cameras = configuration.get('cameras')
     for index, acamera in enumerate(cameras):
         if acamera['url'] == self.camera['url']:
             acamera['on'] = False
             cameras[index] = acamera
     configuration.save()
     self.stop()
Пример #33
0
def change_wallpaper():
    configuration = Configuration()
    source = configuration.get('source')
    if source == 'national-geographic':
        set_national_geographic_wallpaper()
    elif source == 'bing':
        set_bing_wallpaper()
    elif source == 'gopro':
        set_gopro_wallpaper()
    elif source == 'powder':
        set_powder_wallpaper()
Пример #34
0
    def instanciate():
        configuration = Configuration()
        preferences = configuration.get('preferences')

        https_protocol = preferences['https_protocol']
        base_url = preferences['base_url']
        client_token = preferences['client_token']

        cache = Cache(https_protocol, base_url, client_token)

        cache.startCaching()
Пример #35
0
def main():
    GObject.threads_init()
    configuration = Configuration()
    cameras = configuration.get('cameras')
    if len(cameras) > 0:
        for acamera in cameras:
            cm = CameraWidget(acamera)
            cm.show()
            cm.start_updater()
        Gtk.main()
    exit(0)
Пример #36
0
 def save_preferences(self):
     configuration = Configuration()
     x, y = self.get_position()
     cameras = configuration.get('cameras')
     for index, acamera in enumerate(cameras):
         if acamera['url'] == self.camera['url']:
             acamera['x'] = x
             acamera['y'] = y
             acamera['onwidgettop'] = self.is_above
             cameras[index] = acamera
     configuration.save()
	def set_events(self,events):
		configuration = Configuration()
		self.store.clear()
		for event in events:
			label = ''
			if 'summary' in event.keys():
				label = event['summary']
			if configuration.has(event['calendar_id']):
				color = configuration.get(event['calendar_id'])
			else:
				color = '#AFDEDF'
			self.store.append([label,event,color])
Пример #38
0
 def load_changed(self, widget, load_event):
     if load_event == WebKit2.LoadEvent.FINISHED:
         self.update()
         configuration = Configuration()
         preferences = configuration.get('preferences')
         distance_color = preferences['distance-color']
         clics_color = preferences['clics-color']
         keys_color = preferences['keys-color']
         self.web_send('set_colors("{}", "{}", "{}");'.format(
             distance_color, clics_color, keys_color))
         while Gtk.events_pending():
             Gtk.main_iteration()
Пример #39
0
 def load_preferences(self):
     configuration = Configuration()
     self.sample_time.set_value(configuration.get("frames"))
     self.scale.set_active(configuration.get("scale"))
     self.modify_width.set_active(configuration.get("modify-width"))
     self.width.set_value(configuration.get("width"))
     self.modify_height.set_active(configuration.get("modify-height"))
     self.height.set_value(configuration.get("height"))
	def load_preferences(self,tasks):
		self.switch1.set_active(os.path.exists(comun.TOKEN_FILE))
		configuration = Configuration()
		if os.path.exists(os.path.join(os.getenv("HOME"),".config/autostart/google-tasks-indicator-autostart.desktop")):
			self.switch4.set_active(True)
		if configuration.get('local') == 0:
			self.option_tlo['copy'].set_active(True)
		elif configuration.get('local') == 1:
			self.option_tlo['delete'].set_active(True)
		else:
			self.option_tlo['none'].set_active(True)			
		#
		if configuration.get('external') == 0:
			self.option_teo['copy'].set_active(True)
		elif configuration.get('external') == 1:
			self.option_teo['delete'].set_active(True)
		else:
			self.option_teo['none'].set_active(True)			
		#
		if configuration.get('both') == 0:
			self.option_tb['copy local'].set_active(True)
		elif configuration.get('both') == 1:
			self.option_tb['copy external'].set_active(True)
		else:
			self.option_tb['none'].set_active(True)			
		#
		if configuration.get('theme') == 'light':
			self.switch5.set_active(True)
		else:
			self.switch5.set_active(False)
		tasklist_id = configuration.get('tasklist_id')
		if tasks is not None:
			self.liststore.clear()
			self.liststore.append([_('All'),None])			
			for tasklist in tasks.tasklists.values():
				self.liststore.append([tasklist['title'],tasklist['id']])
			if tasklist_id is None:
				self.entry2.set_active(0)
			else:
				for i,item in enumerate(self.liststore):
					print(tasklist_id,item[1])
					if tasklist_id == item[1]:
						self.entry2.set_active(i)
						break
		
		if os.path.exists(comun.TOKEN_FILE):
			gta = GTAService(token_file = comun.TOKEN_FILE)
	def load_preferences(self):
		self.switch1.set_active(os.path.exists(comun.TOKEN_FILE))
		configuration = Configuration()
		time = configuration.get('time')
		theme = configuration.get('theme')
		calendars_options = configuration.get('calendars')
		self.spin3.set_value(time)
		if os.path.exists(os.path.join(os.getenv("HOME"),".config/autostart/calendar-indicator-autostart.desktop")):
			self.switch4.set_active(True)
		if theme == 'light':
			self.switch5.set_active(True)
		else:
			self.switch5.set_active(False)
		if os.path.exists(comun.TOKEN_FILE):
			if self.googlecalendar is not None:				
				calendars = self.googlecalendar.calendars.values()
			else:
				gca = GoogleCalendar(token_file = comun.TOKEN_FILE)
				gca.read()
				calendars = gca.get_calendars().values()
			self.store.clear()
			for calendar in calendars:
				calendar_options = get_calendar_from_options(configuration.get('calendars'),calendar['id'])
				if calendar_options:
					background_color = calendar_options['background']
					foreground_color = calendar_options['foreground']
					visible = calendar_options['visible']
					if 'name' in calendar_options.keys():
						calendar_name = calendar_options['name']
					else:
						calendar_name = calendar['summary']
				else:
					background_color = tohex(random.randint(0, 16777215))
					foreground_color = tohex(random.randint(0, 16777215))
					visible = True
					calendar_name = calendar['summary']
				self.store.append([calendar['summary'],background_color,foreground_color,calendar['id'],visible,calendar_name])
 def change_state(self):
     if not self.on_mouse_plugged or\
             not is_mouse_plugged():
         is_touch_enabled = self.touchpad.are_all_touchpad_enabled()
         if self.disable_on_typing is True:
             print('1', is_touch_enabled)
             configuration = Configuration()
             is_touch_enabled = configuration.get('touchpad_enabled')
             print('2', is_touch_enabled)
             print('3 {0} touchpad'.format(
                 'Enable' if not is_touch_enabled else 'Disable'))
             self.set_touch_enabled(not is_touch_enabled)
             self.keyboardMonitor.set_on(not is_touch_enabled)
         else:
             self.set_touch_enabled(not is_touch_enabled)
Пример #43
0
	def load_preferences(self):
		configuration = Configuration()
		language = configuration.get('language')
		dictionary = configuration.get('dictionary')
		print(language)
		print(dictionary)
		itera = self.model1.get_iter_first()
		while itera != None:
			if self.model1.get_value(itera,1) == language:
				break					
			itera = self.model1.iter_next(itera)
		if itera != None:
			self.combobox1.set_active_iter(itera)
		else:
			self.combobox1.set_active(0)
		itera = self.model2.get_iter_first()
		while itera != None:
			if self.model2.get_value(itera,1) == dictionary:
				break					
			itera = self.model2.iter_next(itera)
		if itera != None:
			self.combobox2.set_active_iter(itera)
		else:
			self.combobox2.set_active(0)		
Пример #44
0
	def set_events(self,events):
		configuration = Configuration()
		self.store.clear()
		for event in events:
			label = ''
			if 'summary' in event.keys():
				label = event['summary']
			calendar_options = get_calendar_from_options(configuration.get('calendars'),event['calendar_id'])
			if calendar_options:
				background_color = calendar_options['background']
				foreground_color = calendar_options['foreground']
				visible = calendar_options['visible']
			else:
				background_color = tohex(random.randint(0, 16777215))
				foreground_color = tohex(random.randint(0, 16777215))
				visible = True
			if event is not None:
				self.store.append([label,event,background_color,foreground_color])
Пример #45
0
 def on_button_ok_clicked(self, widget):
     start_position = self.spinbutton_begin.get_value()
     end_position = self.spinbutton_end.get_value()
     duration = end_position - start_position
     output_file = self.button_output.get_label()
     if os.path.exists(output_file):
         os.remove(output_file)
     if os.path.exists(output_file + ".tmp"):
         os.remove(output_file + ".tmp")
     if self.filename is not None and os.path.exists(self.filename) and duration > 0:
         configuration = Configuration()
         frames = configuration.get("frames")
         scale = configuration.get("scale")
         modify_width = configuration.get("modify-width")
         width = configuration.get("width")
         modify_height = configuration.get("modify-height")
         height = configuration.get("height")
         if scale is True:
             if modify_width is True:
                 t_width = str(width)
             else:
                 t_width = "-1"
             if modify_height is True:
                 t_height = str(height)
             else:
                 t_height = "-1"
             if t_width != "-1" or t_height != "-1":
                 scale_t = " -vf scale=%s:%s " % (t_width, t_height)
             else:
                 scale_t = ""
         else:
             scale_t = ""
         # input_file, output_file, start_position, duration,
         #             frames, scale_t):
         progreso = Progreso(_("Converting video"), self, 100)
         convertVideo = ConvertVideo(self.filename, output_file, start_position, duration, frames, scale_t)
         progreso.connect("i-want-stop", convertVideo.stop_it)
         convertVideo.connect("processed", progreso.set_value)
         convertVideo.connect("interrupted", progreso.close)
         convertVideo.start()
         progreso.run()
 def load_preferences(self):
     configuration = Configuration()
     self.switch1.set_active(configuration.get('monitor-clipboard'))
     self.switch2.set_active(os.path.exists(comun.FILE_AUTO_START))
     self.switch3.set_active(configuration.get('theme') == 'light')
     self.downloaddir.set_text(configuration.get('download-dir'))
Пример #47
0
 def load_preferences(self):
     configuration = Configuration()
     self.show_hdd = configuration.get('show-hdd')
     self.show_net = configuration.get('show-net')
Пример #48
0
 def load_preferences(self):
     configuration = Configuration()
     self.switch21.set_active(configuration.get(
         'markdown_editor.show_line_numbers'))
     self.switch22.set_active(configuration.get(
         'markdown_editor.show_line_marks'))
     self.switch23.set_active(configuration.get(
         'markdown_editor.spaces'))
     self.spinbutton24.set_value(configuration.get(
         'markdown_editor.tab_width'))
     self.switch25.set_active(configuration.get(
         'markdown_editor.auto_indent'))
     self.switch26.set_active(configuration.get(
         'markdown_editor.highlight_current_line'))
     self.button27.set_label(configuration.get(
         'markdown_editor.font'))
     self.switch31.set_active(configuration.get(
         'html_viewer.show_line_numbers'))
     self.switch32.set_active(configuration.get(
         'html_viewer.show_line_marks'))
     self.switch33.set_active(configuration.get(
         'html_viewer.spaces'))
     self.spinbutton34.set_value(configuration.get(
         'html_viewer.tab_width'))
     self.switch35.set_active(configuration.get(
         'html_viewer.auto_indent'))
     self.switch36.set_active(configuration.get(
         'html_viewer.highlight_current_line'))
     select_value_in_combo(
         self.combobox_preview_theme,
         configuration.get('html_viewer.preview_theme'))
     self.switch41.set_active(configuration.get('autosave'))
     self.switch42.set_active(configuration.get('spellcheck'))
     self.switch43.set_active(configuration.get('mathjax'))
     self.switch51.set_active(os.path.exists(comun.TOKEN_FILE))
     self.switch52.set_active(os.path.exists(comun.TOKEN_FILE_DRIVE))
Пример #49
0
 def load_preferences(self):
     configuration = Configuration()
     first_time = configuration.get('first-time')
     version = configuration.get('version')
     weatherservice = configuration.get('weather-service')
     if weatherservice == 'yahoo':
         self.radiobutton251.set_active(True)
     elif weatherservice == 'worldweatheronline':
         self.radiobutton252.set_active(True)
     elif weatherservice == 'openweathermap':
         self.radiobutton253.set_active(True)
     elif weatherservice == 'wunderground':
         self.radiobutton254.set_active(True)
     wwokey = configuration.get('wwo-key')
     if len(wwokey) > 0:
         self.wwokey.set_text(wwokey)
         wwo = WorldWeatherOnlineService(key=wwokey)
         if wwo.test_connection():
             self.radiobutton252.set_sensitive(True)
         else:
             if weatherservice == 'worldweatheronline':
                 self.radiobutton253.set_active(True)
     wukey = configuration.get('wu-key')
     if len(wukey) > 0:
         self.wukey.set_text(wukey)
         uws = UndergroundWeatherService(key=self.wukey.get_text())
         if uws.test_connection():
             self.radiobutton254.set_sensitive(True)
         else:
             if weatherservice == 'wunderground':
                 self.radiobutton253.set_active(True)
     #
     self.checkbutton11.set_active(configuration.get('main-location'))
     self.checkbutton10.set_active(configuration.get('autolocation'))
     self.location = configuration.get('location')
     self.latitude = configuration.get('latitude')
     self.longitude = configuration.get('longitude')
     if self.location:
         self.entry11.set_text(self.location)
     self.checkbutton12.set_active(configuration.get('show-temperature'))
     self.checkbutton13.set_active(configuration.get('show-notifications'))
     self.checkbutton14.set_active(configuration.get('widget1'))
     self.checkbutton15.set_active(configuration.get('onwidget1hide'))
     self.checkbutton15.set_sensitive(self.checkbutton14.get_active())
     self.checkbutton16.set_active(configuration.get('onwidget1top'))
     self.checkbutton16.set_sensitive(self.checkbutton14.get_active())
     self.checkbutton17.set_active(configuration.get('showintaskbar1'))
     self.checkbutton17.set_sensitive(self.checkbutton14.get_active())
     self.checkbutton18.set_active(configuration.get('onalldesktop1'))
     self.checkbutton18.set_sensitive(self.checkbutton14.get_active())
     select_value_in_combo(self.comboboxskin1, configuration.get('skin1'))
     self.comboboxskin1.set_sensitive(self.checkbutton14.get_active())
     #
     self.checkbutton21.set_active(configuration.get('second-location'))
     self.location2 = configuration.get('location2')
     self.latitude2 = configuration.get('latitude2')
     self.longitude2 = configuration.get('longitude2')
     if self.location2:
         self.entry21.set_text(self.location2)
     self.checkbutton22.set_active(configuration.get('show-temperature2'))
     self.checkbutton23.set_active(configuration.get('show-notifications2'))
     self.checkbutton24.set_active(configuration.get('widget2'))
     self.checkbutton25.set_active(configuration.get('onwidget2hide'))
     self.checkbutton25.set_sensitive(self.checkbutton24.get_active())
     self.checkbutton26.set_active(configuration.get('onwidget2top'))
     self.checkbutton26.set_sensitive(self.checkbutton24.get_active())
     self.checkbutton27.set_active(configuration.get('showintaskbar2'))
     self.checkbutton27.set_sensitive(self.checkbutton24.get_active())
     self.checkbutton28.set_active(configuration.get('onalldesktop2'))
     self.checkbutton28.set_sensitive(self.checkbutton24.get_active())
     select_value_in_combo(self.comboboxskin2, configuration.get('skin2'))
     self.comboboxskin2.set_sensitive(self.checkbutton24.get_active())
     #
     select_value_in_combo(self.combobox3, configuration.get('temperature'))
     select_value_in_combo(self.combobox32, configuration.get('pressure'))
     select_value_in_combo(self.combobox33, configuration.get('visibility'))
     select_value_in_combo(self.combobox31, configuration.get('wind'))
     select_value_in_combo(self.combobox34, configuration.get('rain'))
     select_value_in_combo(self.combobox35, configuration.get('snow'))
     select_value_in_combo(self.combobox36, configuration.get('24h'))
     select_value_in_combo(self.combobox45, configuration.get('refresh'))
     #
     self.radiobutton31.set_active(configuration.get('icon-light'))
     self.radiobutton32.set_active(not configuration.get('icon-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()
        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'))
Пример #51
0
	def read_preferences(self):
		configuration = Configuration()
		self.first_time = configuration.get('first-time')
		self.version = configuration.get('version')
		self.shortcut_enabled = configuration.get('shortcut_enabled')
		self.autostart = configuration.get('autostart')
		self.on_mouse_plugged = configuration.get('on_mouse_plugged')
		self.enable_on_exit = configuration.get('enable_on_exit')
		self.disable_on_exit = configuration.get('disable_on_exit')
		self.start_hidden = configuration.get('start_hidden')
		self.show_notifications = configuration.get('show_notifications')
		self.theme = configuration.get('theme')
		self.touchpad_enabled = configuration.get('touchpad_enabled')
		self.disable_touchpad_on_start_indicator = configuration.get('disable_touchpad_on_start_indicator')
		##
		self.syndaemon = Syndaemon(configuration.get('seconds'))
		if configuration.get('disable_on_typing'):
			self.syndaemon.start()
		else:
			self.syndaemon.stop()
		self.shortcut = configuration.get('shortcut')
		self.ICON = comun.ICON
		self.active_icon = comun.STATUS_ICON[configuration.get('theme')][0]
		self.attention_icon = comun.STATUS_ICON[configuration.get('theme')][1]
		self.synclient.set('VertEdgeScroll',1 if configuration.get('VertEdgeScroll') else 0)
		self.synclient.set('HorizEdgeScroll',1 if configuration.get('HorizEdgeScroll') else 0)
		self.synclient.set('CircularScrolling',1 if configuration.get('CircularScrolling') else 0)
		self.synclient.set('VertTwoFingerScroll',1 if configuration.get('VertTwoFingerScroll') else 0)
		self.synclient.set('HorizTwoFingerScroll',1 if configuration.get('HorizTwoFingerScroll') else 0)
		self.synclient.set('TapButton1',configuration.get('TapButton1'))
		self.synclient.set('TapButton2',configuration.get('TapButton2'))
		self.synclient.set('TapButton3',configuration.get('TapButton3'))
		if configuration.get('natural_scrolling'):
			self.synclient.set('VertScrollDelta',-abs(int(self.synclient.get('VertScrollDelta'))))
			self.synclient.set('HorizScrollDelta',-abs(int(self.synclient.get('HorizScrollDelta'))))
		else:
			self.synclient.set('VertScrollDelta',abs(int(self.synclient.get('VertScrollDelta'))))
			self.synclient.set('HorizScrollDelta',abs(int(self.synclient.get('HorizScrollDelta'))))
Пример #52
0
	def check_status(self):
		configuration = Configuration()
		self.touchpad_enabled = configuration.get('touchpad_enabled')
		if self.touchpad_enabled != self.touchpad.are_all_touchpad_enabled():
			self.set_touch_enabled(self.touchpad_enabled)
Пример #53
0
 def load_preferences(self):
     configuration = Configuration()
     self.switch1.set_active(os.path.exists(comun.AUTOSTARTD))
     self.switch2.set_active(configuration.get('theme') == 'light')
     self.webcam_show.set_active(configuration.get('webcam-show'))
     self.webcam_onwidgettop.set_active(
         configuration.get('webcam-onwidgettop'))
     self.webcam_showintaskbar.set_active(
         configuration.get('webcam-showintaskbar'))
     self.webcam_onalldesktop.set_active(
         configuration.get('webcam-onalldesktop'))
     self.widgets = []
     cameras = configuration.get('cameras')
     for index, acamera in enumerate(cameras):
         data = {}
         vbox11 = Gtk.VBox(spacing=5)
         vbox11.set_border_width(5)
         ncamera = str(index + 1)
         self.notebook.append_page(
             vbox11, Gtk.Label.new(_('Camera') + ' ' + ncamera))
         frame11 = Gtk.Frame()
         vbox11.pack_start(frame11, False, True, 1)
         table11 = Gtk.Table(7, 2, False)
         frame11.add(table11)
         label11 = Gtk.Label(_('Url')+':')
         label11.set_alignment(0, 0.5)
         table11.attach(label11, 0, 1, 0, 1,
                        xpadding=5,
                        ypadding=5,
                        xoptions=Gtk.AttachOptions.FILL)
         data['url'] = Gtk.Entry()
         data['url'].set_width_chars(80)
         data['url'].set_sensitive(False)
         data['url'].set_text(acamera['url'])
         table11.attach(data['url'], 1, 2, 0, 1,
                        xpadding=5,
                        ypadding=5,
                        xoptions=Gtk.AttachOptions.FILL)
         label12 = Gtk.Label(_('Scale')+':')
         label12.set_alignment(0, 0.5)
         table11.attach(label12, 0, 1, 1, 2,
                        xpadding=5,
                        ypadding=5,
                        xoptions=Gtk.AttachOptions.FILL)
         data['scale'] = Gtk.SpinButton()
         data['scale'].set_adjustment(
             Gtk.Adjustment.new(acamera['scale'],
                                1,
                                101,
                                1,
                                10,
                                1))
         table11.attach(data['scale'], 1, 2, 1, 2,
                        xpadding=5,
                        ypadding=5,
                        xoptions=Gtk.AttachOptions.SHRINK)
         label14 = Gtk.Label(_('Widget on top')+':')
         label14.set_alignment(0, 0.5)
         table11.attach(label14, 0, 1, 2, 3,
                        xpadding=5,
                        ypadding=5,
                        xoptions=Gtk.AttachOptions.FILL)
         data['onwidgettop'] = Gtk.Switch()
         data['onwidgettop'].set_active(acamera['onwidgettop'])
         table11.attach(data['onwidgettop'], 1, 2, 2, 3,
                        xpadding=5,
                        ypadding=5,
                        xoptions=Gtk.AttachOptions.SHRINK)
         label15 = Gtk.Label(_('Show in taskbar')+':')
         label15.set_alignment(0, 0.5)
         table11.attach(label15, 0, 1, 3, 4,
                        xpadding=5,
                        ypadding=5,
                        xoptions=Gtk.AttachOptions.FILL)
         data['showintaskbar'] = Gtk.Switch()
         data['showintaskbar'].set_active(acamera['showintaskbar'])
         table11.attach(data['showintaskbar'], 1, 2, 3, 4,
                        xpadding=5,
                        ypadding=5,
                        xoptions=Gtk.AttachOptions.SHRINK)
         label16 = Gtk.Label(_('Show on all desktop')+':')
         label16.set_alignment(0, 0.5)
         table11.attach(label16, 0, 1, 4, 5,
                        xpadding=5,
                        ypadding=5,
                        xoptions=Gtk.AttachOptions.FILL)
         data['onalldesktop'] = Gtk.Switch()
         data['onalldesktop'].set_active(acamera['onalldesktop'])
         table11.attach(data['onalldesktop'], 1, 2, 4, 5,
                        xpadding=5,
                        ypadding=5,
                        xoptions=Gtk.AttachOptions.SHRINK)
         label17 = Gtk.Label(_('Refresh time')+':')
         label17.set_alignment(0, 0.5)
         table11.attach(label17, 0, 1, 5, 6,
                        xpadding=5,
                        ypadding=5,
                        xoptions=Gtk.AttachOptions.FILL)
         data['refresh-time'] = Gtk.SpinButton()
         data['refresh-time'].set_adjustment(
             Gtk.Adjustment.new(acamera['refresh-time'],
                                10,
                                3600,
                                10,
                                50,
                                10))
         table11.attach(data['refresh-time'], 1, 2, 5, 6,
                        xpadding=5,
                        ypadding=5,
                        xoptions=Gtk.AttachOptions.SHRINK)
         label17 = Gtk.Label(_('On')+':')
         label17.set_alignment(0, 0.5)
         table11.attach(label17, 0, 1, 6, 7,
                        xpadding=5,
                        ypadding=5,
                        xoptions=Gtk.AttachOptions.FILL)
         data['on'] = Gtk.Switch()
         if 'on' in acamera.keys():
             data['on'].set_active(acamera['on'])
         else:
             data['on'].set_active(True)
         table11.attach(data['on'], 1, 2, 6, 7,
                        xpadding=5,
                        ypadding=5,
                        xoptions=Gtk.AttachOptions.SHRINK)
         remove_button = Gtk.Button()
         remove_button.set_label(_('Remove camera') + ' ' + ncamera)
         remove_button.connect('clicked',
                               self.on_remove_button_clicked)
         table11.attach(remove_button, 0, 2, 7, 8,
                        xpadding=5,
                        ypadding=5,
                        xoptions=Gtk.AttachOptions.SHRINK)
         self.widgets.append(data)
 def read_preferences(self):
     configuration = Configuration()
     self.first_time = configuration.get('first-time')
     self.version = configuration.get('version')
     self.theme = configuration.get('theme')
     self.max_pomodoros = configuration.get('number_of_pomodoros')
     self.session_length = configuration.get('session_length')
     self.break_length = configuration.get('break_length')
     self.long_break_length = configuration.get('long_break_length')
     self.play_sounds = configuration.get('play_sounds')
     self.session_sound_file = configuration.get('session_sound_file')
     self.break_sound_file = configuration.get('break_sound_file')
     self.active_icon = comun.STATUS_ICON[configuration.get('theme')][0]