Yes it is very possible. I have done a test to show it is possible. In this example I have simply used a local python on my machine with WxPython installed, and grabbed the 3rd party python color picker dialog from xoomer.virgilio.it/infinity77/AG … ialog.html called CubeColourDialog. I created a simple program that provides the CubeColourDialog Gui based off a demo they had posted:
[pre=#2D2D2D]import wx
import wx.lib.agw.cubecolourdialog as CCD
import json
Our normal wxApp-derived class, as usual
app = wx.App(0)
colourData = wx.ColourData()
dlg = CCD.CubeColourDialog(None, colourData)
if dlg.ShowModal() == wx.ID_OK:
# If the user selected OK, then the dialog's wx.ColourData will
# contain valid information. Fetch the data ...
colourData = dlg.GetColourData()
h, s, v, a = dlg.GetHSVAColour()
# ... then do something with it. The actual colour data will be
# returned as a three-tuple (r, g, b) in this particular case.
colour = colourData.GetColour()
r, g, b, alpha = colour.Red(), colour.Green(), colour.Blue(), colour.Alpha()
colors = {
"rgba": (r, g, b, alpha),
"hsva": (h, s, v, a)
}
print json.dumps(colors)
else:
print “{}”
Once the dialog is destroyed, Mr. wx.ColourData is no longer your
friend. Don’t use it again!
dlg.Destroy()
app.MainLoop()[/pre]
I compiled it as an EXE with pyinstaller pyinstaller.org/ and then accessed the executable via a sublime plugin and output the result in the debug panel.
[pre=#2D2D2D]import sublime
import sublime_plugin
import subprocess as sp
import os.path as path
import json
def check_output(command):
process = sp.Popen(command, shell=True, stdout=sp.PIPE, stderr=sp.STDOUT, universal_newlines=True)
output = process.communicate()
retcode = process.poll()
if retcode:
raise(sp.CalledProcessError(retcode, command, output=output0]))
return output0]
class ColorTestCommand(sublime_plugin.TextCommand):
def run(self, edit):
print(“ColorTest: Custom Color Dialog Feasibility Demo”)
cmd = path.join(sublime.packages_path(), “ColorTest”, “clr_pick.exe”)
colors = json.loads(check_output(cmd))
if “rgba” in colors and “hsva” in colors:
print(“ColorTest (rgba): r=%d, g=%d, b=%d, a=%d” % tuple(colors"rgba"]))
print(“ColorTest (hsva): h=%d, s=%d, v=%d, a=%d” % tuple(colors"hsva"]))
else:
print(“No color selected!”)[/pre]
Results:
>>> sublime.active_window().active_view().run_command("color_test")
ColorTest: Custom Color Dialog Feasibility Demo
ColorTest (rgba): r=67, g=188, b=117, a=255
ColorTest (hsva): h=145, s=163, v=188, a=255
It would be better if I threaded this and the dialog is a little buggy, but this shows you can create your own custom dialogs etc. and access them from sublime. You don’t have to create the executable in python like I did, but this just shows you can create your own custom gui to do stuff. I think this is an untapped approach that developers could really do some neat stuff with.