def load(self): weight = SETTINGS.get_int('default-weight') source_list = [] if not self.has_save_file(): return source_list with open(self.save_file, 'r') as f: entry = json.load(f) for dir in entry: data = { 'target': '', 'argument': '', 'weight': weight, 'options': {} } for key, value in entry[dir].items(): if key in ['source', 'target', 'argument', 'weight']: data[key] = value else: data['options'][key] = value source_list.append(data) source_list.sort(cmp=lambda x, y: cmp(y['weight'], x['weight'])) return source_list
def _start_timer(self, change=True): frame = self.photoframe is_mouse_over = frame.check_mouse_on_frame() and change != 'force' if change and not is_mouse_over and not frame.has_trash_dialog(): self.recursion_depth = 0 updated = self._change_photo() else: updated = False if updated is False: interval = 3 # print "skip!" elif frame.is_fullscreen() or frame.is_screensaver(): interval = SETTINGS.get_int('interval-fullscreen') else: interval = SETTINGS.get_int('interval') self._timer = GLib.timeout_add_seconds(interval, self._start_timer) return False
def load(self): weight = SETTINGS.get_int('default-weight') source_list = [] if not self.has_save_file(): return source_list with open(self.save_file, 'r') as f: entry = json.load(f) for dir in entry: data = { 'target' : '', 'argument' : '', 'weight' : weight, 'options' : {} } for key, value in entry[dir].items(): if key in ['source', 'target', 'argument', 'weight']: data[key] = value else: data['options'][key] = value source_list.append(data) source_list.sort(cmp=lambda x,y: cmp(y['weight'], x['weight'])) return source_list