def get_button_icon(config, button, prefer_bw=False): """ For config returned by load_gui_config() and SCButton constant, returns icon filename assigned to that button in controller config or default if config is invalid or button unassigned. """ return find_button_image(ControllerManager.get_button_name( config, button), prefer_bw=prefer_bw)
def get_button_icon(config, button, prefer_bw=False): """ For config returned by load_gui_config() and SCButton constant, returns icon name assigned to that button in controller config or default if config is invalid or button unassigned. """ index = BUTTON_ORDER.index(button) name = ControllerManager.DEFAULT_ICONS[index] try: name = config['gui']['buttons'][index] except: pass return find_button_image(name, prefer_bw=prefer_bw)
def get_button_image(self, x, size): """ Loads and returns button image as pixbuf. Pixbufs are cached. """ if x not in self._button_images: path, bw = find_button_image(x, prefer_bw=True) if path is None: self._button_images[x] = None return None buf = GdkPixbuf.Pixbuf.new_from_file_at_size(path, size, size) buf = self.increase_contrast(buf) self._button_images[x] = buf i = self._button_images[x] return i