GithubHelp home page GithubHelp logo

Comments (28)

m4tm4t avatar m4tm4t commented on July 17, 2024

Same issue here

from colorpicker.

efolio avatar efolio commented on July 17, 2024

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

from colorpicker.

LinuCC avatar LinuCC commented on July 17, 2024

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)

from colorpicker.

LinuCC avatar LinuCC commented on July 17, 2024

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()

from colorpicker.

tarpan avatar tarpan commented on July 17, 2024

Works for me. Thanks.

from colorpicker.

bordaigorl avatar bordaigorl commented on July 17, 2024

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 ?

from colorpicker.

sambody avatar sambody commented on July 17, 2024

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.

from colorpicker.

thomporter avatar thomporter commented on July 17, 2024

Ubuntu 14.04 x64 here with ST3. The fix works perfectly for me, love it!

from colorpicker.

enapupe avatar enapupe commented on July 17, 2024

Worked here
ubuntu 13.10 st3 3059

from colorpicker.

otger avatar otger commented on July 17, 2024

Fix by @CaiusCaligulaCC worked for me.

Ubuntu 14.04 32bits, st3 3059

from colorpicker.

rakelley avatar rakelley commented on July 17, 2024

Thank you for the fix.

Mint 17 x64, ST3

from colorpicker.

vespakoen avatar vespakoen commented on July 17, 2024

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:

  • rename Gtk -> gtk
  • removed the gi.repository (not sure if this is correct, but I got errors with that statement in the include)
  • used gtk.RESPONSE_OK instead of gtk.ResponseType.OK

Hope it might help anyone

from colorpicker.

txtsd avatar txtsd commented on July 17, 2024

@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

from colorpicker.

rafaelcanovas avatar rafaelcanovas commented on July 17, 2024

I have a working version that maintains compatibility with the older versions, can you guys test it?

from colorpicker.

eyalzek avatar eyalzek commented on July 17, 2024

LinuCC's fix worked for me on ST2 (Xubuntu 14.04)

from colorpicker.

rafaelcanovas avatar rafaelcanovas commented on July 17, 2024

@eyalzek can you test my version? It maintains backwards compatibility. So we can have a merge in the near future. Thank you!

from colorpicker.

eyalzek avatar eyalzek commented on July 17, 2024

@mstrcnvs it seems to be working fine

from colorpicker.

weslly avatar weslly commented on July 17, 2024

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.

from colorpicker.

rafaelcanovas avatar rafaelcanovas commented on July 17, 2024

Cheers @weslly!

from colorpicker.

slavugan avatar slavugan commented on July 17, 2024

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.

from colorpicker.

markandrewj avatar markandrewj commented on July 17, 2024

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

from colorpicker.

rafaelcanovas avatar rafaelcanovas commented on July 17, 2024

@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.

from colorpicker.

slavugan avatar slavugan commented on July 17, 2024

@mstrcnvs Where can I take your working version for test?

from colorpicker.

rafaelcanovas avatar rafaelcanovas commented on July 17, 2024

@slavugan http://github.com/mstrcnvs/ColorPicker

from colorpicker.

slavugan avatar slavugan commented on July 17, 2024

@mstrcnvs it works good, so you can merge ))

from colorpicker.

Rob-ot avatar Rob-ot commented on July 17, 2024

You guys rock!

from colorpicker.

weslly avatar weslly commented on July 17, 2024

The fix was merged and released.

from colorpicker.

markandrewj avatar markandrewj commented on July 17, 2024

sorry I didn't have a moment to test, glad the bug has been closed, ty for patching

from colorpicker.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.