From 69d0aa8b0e1c2b493be8bb38b527eb66b2d73953 Mon Sep 17 00:00:00 2001 From: LaPeGa Date: Fri, 24 Jun 2022 15:40:17 -0300 Subject: [PATCH 1/3] Add files via upload Added a line to support Sublime 4 under new gnome 4 --- sublimecp.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/sublimecp.py b/sublimecp.py index 442a5c1..acac790 100755 --- a/sublimecp.py +++ b/sublimecp.py @@ -4,10 +4,10 @@ import os from stat import * -sublime_version = 2 +sublime_version = 3 -if not sublime.version() or int(sublime.version()) > 3000: - sublime_version = 3 +if not sublime.version() or int(sublime.version()) > 4000: + sublime_version = 4 if sublime.platform() == 'windows': @@ -362,16 +362,21 @@ def run(self, settings): class ColorPickCommand(sublime_plugin.TextCommand): def run(self, edit): sel = self.view.sel() + selected = None prefix = '#' + # get the currently selected color - if any if len(sel) > 0: selected = self.view.substr(self.view.word(sel[0])).strip() if selected.startswith('#'): selected = selected[1:] + elif selected.startswith('\''): + selected = selected[2:] elif selected.startswith('0x'): selected = selected[2:] prefix = '0x' + print("AAa: "+ selected) cp = ColorPicker() color = cp.pick(self.view.window(), selected) From d22c35f9c02dda74b80f5756f674fb9cd48a8bad Mon Sep 17 00:00:00 2001 From: LaPeGa Date: Fri, 24 Jun 2022 15:41:19 -0300 Subject: [PATCH 2/3] Add files via upload Add support to python3 under linux, and another change to support gnome 4 --- lib/linux_colorpicker.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/linux_colorpicker.py b/lib/linux_colorpicker.py index 1aa3d7b..a0e8e70 100755 --- a/lib/linux_colorpicker.py +++ b/lib/linux_colorpicker.py @@ -1,7 +1,6 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 import sys - wx = None Gtk = None @@ -9,6 +8,7 @@ import gi gi.require_version('Gtk', '3.0') from gi.repository import Gtk + from gi.repository import Gdk except ImportError: try: import gtk as Gtk @@ -24,7 +24,6 @@ def open_color_picker_via_gtk(): color_sel = Gtk.ColorSelectionDialog("Sublime Color Picker") - if len(sys.argv) > 1: current_color = Gdk.color_parse(sys.argv[1]) if current_color: From 77c5cfaedc72f20c79cd6923cd52cedab6eb2526 Mon Sep 17 00:00:00 2001 From: LaPeGa Date: Fri, 24 Jun 2022 15:45:14 -0300 Subject: [PATCH 3/3] Fix an error under linux --- sublimecp.py | 1 - 1 file changed, 1 deletion(-) diff --git a/sublimecp.py b/sublimecp.py index acac790..8a4ee0e 100755 --- a/sublimecp.py +++ b/sublimecp.py @@ -376,7 +376,6 @@ def run(self, edit): elif selected.startswith('0x'): selected = selected[2:] prefix = '0x' - print("AAa: "+ selected) cp = ColorPicker() color = cp.pick(self.view.window(), selected)