Closed tarpan closed 9 years ago
Same issue here
Same issue here… although it stopped working at all (even outside selections) a few hours after installing.
De-install / re-install does not fix the issue. Nothing appearing in the console.
Ubuntu - sublime build 3059
The problem is in "lib/linux_colorpicker.py", it crashes with the message: Exception:"'gi.repository.Gtk' object has no attribute 'gdk'" Unfortunately, I dont know anything about Gtk and could not find a solution when banging my head on the keyboard. (I had python logging to a file so I could see the Exception, as Ornthalas said nothing appears in the console)
Well, I've at least found a working solution, but I am not sure if it breaks compatibility with older versions of pyGtk / Linux:
#!/usr/bin/env python
from gi.repository import Gtk
from gi.repository import Gdk
import sys
color_sel = Gtk.ColorSelectionDialog("Sublime Color Picker")
if len(sys.argv) > 1:
if Gdk.color_parse(sys.argv[1]):
color_sel.get_color_selection().set_current_color(Gdk.color_parse(sys.argv[1]))
if color_sel.run() == Gtk.ResponseType.OK:
color = color_sel.get_color_selection().get_current_color()
#Convert to 8bit channels
red = int(color.red / 256)
green = int(color.green / 256)
blue = int(color.blue / 256)
#Format
finalcolor = "%02x%02x%02x" % (red, green, blue)
print (finalcolor.upper())
color_sel.destroy()
Changes made:
Gtk.gdk to from gi.repository import Gdk
colorsel to get_color_selection()
Gtk.gdk.Color() to Gdk.color_parse()
Works for me. Thanks.
It should not be too difficult to catch exceptions to switch to one or the other version depending on the version of Gtk...any plans to update this @weslly ?
Same issue for me - it's not working with keyboard shortcut nor with the command. I'm on Linux Ubuntu, Sublime 3. No message in console.
Ubuntu 14.04 x64 here with ST3. The fix works perfectly for me, love it!
Worked here ubuntu 13.10 st3 3059
Fix by @CaiusCaligulaCC worked for me.
Ubuntu 14.04 32bits, st3 3059
Thank you for the fix.
Mint 17 x64, ST3
Had problems on Ubuntu 14.04 / ST3, made a fix and was going to post it here, to find out that other people already have solved it, shame on me for not using google first, anyways here is my fix:
(~/.config/sublime-text-3/Packages/User/ColorPicker/bin/linux_colorpicker.py)
#!/usr/bin/env python
import gtk
import sys
color_sel = gtk.ColorSelectionDialog("Sublime Color Picker")
if len(sys.argv) > 1:
if gtk.gdk.Color(sys.argv[1]):
color_sel.colorsel.set_current_color(gtk.gdk.Color(sys.argv[1]))
if color_sel.run() == gtk.RESPONSE_OK:
color = color_sel.get_color_selection().get_current_color()
#Convert to 8bit channels
red = int(color.red / 256)
green = int(color.green / 256)
blue = int(color.blue / 256)
#Format
finalcolor = "%02x%02x%02x" % (red, green, blue)
print (finalcolor.upper())
color_sel.destroy()
to test, run this on the console:
python ~/.config/sublime-text-3/Packages/User/ColorPicker/bin/linux_colorpicker.py #ff0000
changes made:
gtk.RESPONSE_OK
instead of gtk.ResponseType.OK
Hope it might help anyone
@vespakoen I applied your changes, but I get this error when running the command in ST3's console.
>>> python ~/.config/sublime-text-3/Packages/User/ColorPicker/bin/linux_colorpicker.py #ff0000
File "<string>", line 1
python ~/.config/sublime-text-3/Packages/User/ColorPicker/bin/linux_colorpicker.py #ff0000
^
SyntaxError: invalid syntax
And the plugin doesn't work at all :/
EDIT: Nevermind. Changing this line to #!/usr/bin/env python2
fixed it
I have a working version that maintains compatibility with the older versions, can you guys test it?
LinuCC's fix worked for me on ST2 (Xubuntu 14.04)
@eyalzek can you test my version? It maintains backwards compatibility. So we can have a merge in the near future. Thank you!
@mstrcnvs it seems to be working fine
I've been using VIM for the last few months but I came back to sublime this week. I'll take a look at the issue(s) and merge the fixes as soon as possible (probably this week or so). Sorry for the waiting.
Cheers @weslly!
ubuntu 14.10 x64 plugin dont start if cursor placed on any color code, but if cusor don't point on color the plugin starts good. For some reasons it can't pick color from sublime. On ST2(2221) and ST3(3065) result the same.
Wanted to confirm this behaviour "ubuntu 14.10 x64 plugin dont start if cursor placed on any color code, but if cusor don't point on color the plugin starts good. For some reasons it can't pick color from sublime. On ST2(2221) and ST3(3065) result the same." on 14.04.1
@slavugan @markandrewj Hi guys, can you test my working version? So that we can get a merge? It should work with cursor placed on a color code.
@mstrcnvs Where can I take your working version for test?
@slavugan http://github.com/mstrcnvs/ColorPicker
@mstrcnvs it works good, so you can merge ))
You guys rock!
The fix was merged and released.
sorry I didn't have a moment to test, glad the bug has been closed, ty for patching
I have been using ST2 for a few months and everything worked fine until today. ColorPicker does not show when a hex value is selected. Otherwise it shows up on the usual ctrl+shift+c combination.