def change_locked_style(self): if self.locked: self.padlock = icons.set_from_name("padlock") self.fixed.put(self.padlock, 100, 77) self.override_background_color(Gtk.StateFlags.NORMAL, self.locked_background_color) else: self.override_background_color(Gtk.StateFlags.NORMAL, self.background_color)
def __init__(self): self.width = 646 self.height = 88 apps = get_app_list() self.projects_list = [] for app in apps: if app in app_profiles: if 'ext' in app_profiles[app]: if app_profiles[app]['dir'] == 'kanoprofile': data_dir = get_app_data_dir(app) else: data_dir = os.path.join(get_home(), app_profiles[app]['dir']) icon_path = os.path.join(image_dir, 'icons', app_profiles[app]['icon']) if not os.path.exists(data_dir): continue files = os.listdir(data_dir) files_filtered = [f for f in files if os.path.splitext(f)[1][1:] == app_profiles[app]['ext']] for filename in files_filtered: project = dict() project['app'] = app project['data_dir'] = data_dir project['file'] = filename project['display_name'] = os.path.splitext(filename)[0] project['icon'] = icon_path self.projects_list.append(project) self.background = Gtk.EventBox() self.background.get_style_context().add_class("project_list_background") self.container = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, spacing=20) self.align = Gtk.Alignment(xalign=0.5, yalign=0.5) self.align.set_padding(10, 10, 20, 20) self.align.add(self.container) self.background.add(self.align) if not self.projects_list: image_no_projects = icons.set_from_name("no_challenges") image_no_projects.set_margin_top(70) self.container.pack_start(image_no_projects, False, False, 0) return for i, project in enumerate(self.projects_list): item = ProjectItem(project) self.container.pack_start(item.background, False, False, 0)
def change_locked_style(self): if self.locked: self.padlock = icons.set_from_name('padlock') self.fixed.put(self.padlock, 100, 77) background_color = self.locked_background_color else: background_color = self.background_color style_provider = Gtk.CssProvider() css = ".badge_background {background: %s}" % background_color style_provider.load_from_data(css) style_context = self.get_style_context() style_context.add_class('badge_background') style_context.add_provider( style_provider, Gtk.STYLE_PROVIDER_PRIORITY_USER )