def set_dark_bg_color(self): if editorpersistance.prefs.theme == appconsts.LIGHT_THEME: return r, g, b, a = gui.unpack_gdk_color(gui.get_bg_color()) global BG_COLOR BG_COLOR = guiutils.get_multiplied_color((r, g, b), 1.25)
def set_dark_bg_color(self): if editorpersistance.prefs.dark_theme == False: return r, g, b, a = gui.unpack_gdk_color(gui.get_bg_color()) global BG_COLOR BG_COLOR = guiutils.get_multiplied_color((r, g, b), 1.25)
def set_item_color(self, widget): if widget.item_number == self.selection: widget.override_background_color(Gtk.StateType.NORMAL, SELECTED_BG) if editorpersistance.prefs.theme == appconsts.LIGHT_THEME: widget.override_color(Gtk.StateType.NORMAL, WHITE_TEXT) else: widget.override_background_color(Gtk.StateType.NORMAL, gui.get_bg_color()) if editorpersistance.prefs.theme == appconsts.LIGHT_THEME: widget.override_color(Gtk.StateType.NORMAL, DARK_TEXT)
def set_item_color(self, selected): if selected == True: self.widget.override_background_color(Gtk.StateType.NORMAL, SELECTED_BG) if editorpersistance.prefs.theme == appconsts.LIGHT_THEME: self.widget.override_color(Gtk.StateType.NORMAL, WHITE_TEXT) else: self.widget.override_background_color(Gtk.StateType.NORMAL, gui.get_bg_color()) if editorpersistance.prefs.theme == appconsts.LIGHT_THEME: self.widget.override_color(Gtk.StateType.NORMAL, DARK_TEXT)
def _draw(self, event, cr, allocation): """ Callback for repaint from CairoDrawableArea. We get cairo context and allocation. """ x, y, w, h = allocation active_width = w - 2 * END_PAD active_height = h - 2 * TOP_PAD # Draw clip bg cr.set_source_rgb(*CLIP_EDITOR_BG_COLOR) cr.rectangle(END_PAD, TOP_PAD, active_width, active_height) cr.fill() # Clip edge and emboss rect = (END_PAD, TOP_PAD, active_width, active_height) self.draw_edge(cr, rect) self.draw_emboss(cr, rect, gui.get_bg_color()) # Draw center line cr.set_source_rgb(0.4, 0.4, 0.4) cr.set_line_width(2.0) cr.move_to(END_PAD, CENTER_LINE_Y) cr.line_to(END_PAD + active_width, CENTER_LINE_Y) cr.stroke() # Draw keyframes for i in range(0, len(self.keyframes)): frame, value = self.keyframes[i] if i == self.active_kf_index: icon = ACTIVE_KF_ICON else: icon = NON_ACTIVE_KF_ICON try: kf_pos = self._get_panel_pos_for_frame(frame) except ZeroDivisionError: # math fails for 1 frame clip kf_pos = END_PAD cr.set_source_surface(icon, kf_pos - 6, KF_Y) cr.paint() # Draw frame pointer try: panel_pos = self._get_panel_pos() except ZeroDivisionError: # math fails for 1 frame clip panel_pos = END_PAD cr.set_line_width(2.0) cr.set_source_rgb(*POINTER_COLOR) cr.move_to(panel_pos, 0) cr.line_to(panel_pos, CLIP_EDITOR_HEIGHT) cr.stroke()
def set_dark_bg_color(self): if editorpersistance.prefs.theme == appconsts.LIGHT_THEME: return global BG_COLOR if editorpersistance.prefs.theme == appconsts.FLOWBLADE_THEME_GRAY or editorpersistance.prefs.theme == appconsts.FLOWBLADE_THEME_NEUTRAL: r, g, b, a = gui.unpack_gdk_color(gui.get_light_gray_light_color()) if editorpersistance.prefs.theme == appconsts.FLOWBLADE_THEME_NEUTRAL: r, g, b, a = gui.unpack_gdk_color( gui.get_light_neutral_color()) BG_COLOR = (r, g, b) else: r, g, b, a = gui.unpack_gdk_color(gui.get_bg_color()) BG_COLOR = guiutils.get_multiplied_color((r, g, b), 1.25)
def _draw_buttons(self, cr, w, h): # Width of buttons group buttons_width = self.button_width * len(self.icons) if self.no_decorations == True: x = self.button_x for i in range(0, len(self.icons)): icon = self.icons[i] cr.set_source_surface(icon, x + self.image_x[i], self.image_y[i]) cr.paint() x += self.button_width return # Line width for all strokes cr.set_line_width(1.0) # bg self._set_button_draw_consts(self.button_x + 0.5, self.button_y + 0.5, buttons_width, self.button_height + 1.0) self._round_rect_path(cr) r, g, b, a = gui.get_bg_color() if self.draw_button_gradients: if self.glass_style == True: cr.set_source_rgb(0.75, 0.75, 0.75) cr.fill_preserve() else: grad = cairo.LinearGradient(self.button_x, self.button_y, self.button_x, self.button_y + self.button_height) if self.dark_theme == False: grad.add_color_stop_rgba(1, r - 0.1, g - 0.1, b - 0.1, 1) grad.add_color_stop_rgba(0, r + 0.1, g + 0.1, b + 0.1, 1) else: grad.add_color_stop_rgba(1, r + 0.04, g + 0.04, b + 0.04, 1) grad.add_color_stop_rgba(0, r + 0.07, g + 0.07, b + 0.07, 1) cr.set_source(grad) cr.fill_preserve() # Pressed button gradient if self.pressed_button > -1: if self.draw_button_gradients: grad = cairo.LinearGradient(self.button_x, self.button_y, self.button_x, self.button_y + self.button_height) if self.glass_style == True: for stop in BUTTONS_PRESSED_GRAD_STOPS: grad.add_color_stop_rgba(*stop) else: grad = cairo.LinearGradient( self.button_x, self.button_y, self.button_x, self.button_y + self.button_height) grad.add_color_stop_rgba(1, r - 0.3, g - 0.3, b - 0.3, 1) grad.add_color_stop_rgba(0, r - 0.1, g - 0.1, b - 0.1, 1) else: grad = cairo.LinearGradient(self.button_x, self.button_y, self.button_x, self.button_y + self.button_height) grad.add_color_stop_rgba(1, r - 0.3, g - 0.3, b - 0.3, 1) grad.add_color_stop_rgba(0, r - 0.3, g - 0.3, b - 0.3, 1) cr.save() cr.set_source(grad) cr.clip() cr.rectangle( self.button_x + self.pressed_button * self.button_width, self.button_y, self.button_width, self.button_height) cr.fill() cr.restore() # Icons and sensitive gradient grad = cairo.LinearGradient(self.button_x, self.button_y, self.button_x, self.button_y + self.button_height) for stop in BUTTON_NOT_SENSITIVE_GRAD_STOPS: grad.add_color_stop_rgba(*stop) x = self.button_x for i in range(0, len(self.icons)): icon = self.icons[i] cr.set_source_surface(icon, x + self.image_x[i], self.image_y[i]) cr.paint() if self.sensitive[i] == False: cr.save() self._round_rect_path(cr) cr.set_source(grad) cr.clip() cr.rectangle(x, self.button_y, self.button_width, self.button_height) cr.fill() cr.restore() x += self.button_width if self.glass_style == True and self.draw_button_gradients: # Glass gradient self._round_rect_path(cr) grad = cairo.LinearGradient(self.button_x, self.button_y, self.button_x, self.button_y + self.button_height) for stop in BUTTONS_GRAD_STOPS: grad.add_color_stop_rgba(*stop) cr.set_source(grad) cr.fill() else: pass if self.dark_theme != True: # Round line grad = cairo.LinearGradient(self.button_x, self.button_y, self.button_x, self.button_y + self.button_height) for stop in LINE_GRAD_STOPS: grad.add_color_stop_rgba(*stop) cr.set_source(grad) self._set_button_draw_consts(self.button_x + 0.5, self.button_y + 0.5, buttons_width, self.button_height) self._round_rect_path(cr) cr.stroke() if self.dark_theme == True: cr.set_source_rgb(0, 0, 0) # Vert lines x = self.button_x for i in range(0, len(self.icons)): if (i > 0) and (i < len(self.icons)): cr.move_to(x + 0.5, self.button_y) cr.line_to(x + 0.5, self.button_y + self.button_height) cr.stroke() x += self.button_width
def _draw_buttons(self, cr, w, h): # Width of buttons group buttons_width = self.button_width * len(self.icons) if self.no_decorations == True: x = self.button_x for i in range(0, len(self.icons)): icon = self.icons[i] cr.set_source_surface(icon, x + self.image_x[i], self.image_y[i]) cr.paint() if self.sensitive[i] == False: cr.save() self._round_rect_path(cr) cr.set_source(grad) cr.clip() cr.rectangle(x, self.button_y, self.button_width, self.button_height) cr.fill() cr.restore() x += self.button_width return # Line width for all strokes cr.set_line_width(1.0) # bg self._set_button_draw_consts(self.button_x + 0.5, self.button_y + 0.5, buttons_width, self.button_height + 1.0) self._round_rect_path(cr) r, g, b, a = gui.get_bg_color() if self.draw_button_gradients: if self.glass_style == True: cr.set_source_rgb(0.75, 0.75, 0.75) cr.fill_preserve() else: grad = cairo.LinearGradient (self.button_x, self.button_y, self.button_x, self.button_y + self.button_height) if self.dark_theme == False: grad.add_color_stop_rgba(1, r - 0.1, g - 0.1, b - 0.1, 1) grad.add_color_stop_rgba(0, r + 0.1, g + 0.1, b + 0.1, 1) else: grad.add_color_stop_rgba(1, r + 0.04, g + 0.04, b + 0.04, 1) grad.add_color_stop_rgba(0, r + 0.07, g + 0.07, b + 0.07, 1) cr.set_source(grad) cr.fill_preserve() # Pressed button gradient if self.pressed_button > -1: if self.draw_button_gradients: grad = cairo.LinearGradient (self.button_x, self.button_y, self.button_x, self.button_y + self.button_height) if self.glass_style == True: for stop in BUTTONS_PRESSED_GRAD_STOPS: grad.add_color_stop_rgba(*stop) else: grad = cairo.LinearGradient (self.button_x, self.button_y, self.button_x, self.button_y + self.button_height) grad.add_color_stop_rgba(1, r - 0.3, g - 0.3, b - 0.3, 1) grad.add_color_stop_rgba(0, r - 0.1, g - 0.1, b - 0.1, 1) else: grad = cairo.LinearGradient (self.button_x, self.button_y, self.button_x, self.button_y + self.button_height) grad.add_color_stop_rgba(1, r - 0.3, g - 0.3, b - 0.3, 1) grad.add_color_stop_rgba(0, r - 0.3, g - 0.3, b - 0.3, 1) cr.save() cr.set_source(grad) cr.clip() cr.rectangle(self.button_x + self.pressed_button * self.button_width, self.button_y, self.button_width, self.button_height) cr.fill() cr.restore() # Icons and sensitive gradient grad = cairo.LinearGradient (self.button_x, self.button_y, self.button_x, self.button_y + self.button_height) for stop in BUTTON_NOT_SENSITIVE_GRAD_STOPS: grad.add_color_stop_rgba(*stop) x = self.button_x for i in range(0, len(self.icons)): icon = self.icons[i] cr.set_source_surface(icon, x + self.image_x[i], self.image_y[i]) cr.paint() if self.sensitive[i] == False: cr.save() self._round_rect_path(cr) cr.set_source(grad) cr.clip() cr.rectangle(x, self.button_y, self.button_width, self.button_height) cr.fill() cr.restore() x += self.button_width if self.glass_style == True and self.draw_button_gradients: # Glass gradient self._round_rect_path(cr) grad = cairo.LinearGradient (self.button_x, self.button_y, self.button_x, self.button_y + self.button_height) for stop in BUTTONS_GRAD_STOPS: grad.add_color_stop_rgba(*stop) cr.set_source(grad) cr.fill() else: pass if self.dark_theme != True: # Round line grad = cairo.LinearGradient (self.button_x, self.button_y, self.button_x, self.button_y + self.button_height) for stop in LINE_GRAD_STOPS: grad.add_color_stop_rgba(*stop) cr.set_source(grad) self._set_button_draw_consts(self.button_x + 0.5, self.button_y + 0.5, buttons_width, self.button_height) self._round_rect_path(cr) cr.stroke() if self.dark_theme == True: cr.set_source_rgb(0,0,0) # Vert lines x = self.button_x for i in range(0, len(self.icons)): if (i > 0) and (i < len(self.icons)): cr.move_to(x + 0.5, self.button_y) cr.line_to(x + 0.5, self.button_y + self.button_height) cr.stroke() x += self.button_width