Sublime Forum

GUI or a dialog box for implementing comments in a plugin

#1

I am trying to write a sublime text plugin to implement Google Docs features (mainly commenting and comment threads and replies) in Sublime Text for collaborative purposes i.e. Reviewing someone else’s code and adding comments to certain lines and storing the comments in a separate file (via the plugin) so that comments can be added at any time and replied to by another user later on in ST.
I desperately needed a GUI or a way to show the comments to the user and allow the user to reply to comments etc.
for entering comments i can use the “input_panel” available in the Sublime API if needed, but I really need a way to display the comments to the user and if possible, reply within the GUI/dialog box itself. Any help would be greatly appreciated.

I have checked out the color picker plugin that uses gtk to show a dialog box on screen and allows the user to pick a color, but cannot figure out how to use the gtk module in my plugin. It gives me an import error.
Any help with this would also sort of solve my problem to some extent. Thanks in advance.

0 Likes

#2

It is basically impossible to get this directly.
The ColorPicker plugin works by defining a python script that defines the GUI and outputs in the stdout the picked value.
Then the ST plugin runs the script by invoking the python interpreter (which needs to be installed) thus bypassing the ST-embedded one, which is not equipped with the gtk module.

0 Likes

#3

You might be able to do something with an output panel. You can load up the content from the external file when the output panel is displayed and possible save any changes down to the external file when the panel looses focus. I am going off of memory, but I added similar functionality to a plugin I build for my employer which would lookup a prepared sal statement and display the code used to create the prepared statement. I even allows users to make changes in the output panel and updated the prepared statement inplace. This saves us from having to leave our current location to update the prepared statement.

If I get a second I’ll post an quick example…after I update some thing’s in another plugin.

0 Likes

#4

[quote=“huot25”]You might be able to do something with an output panel. You can load up the content from the external file when the output panel is displayed and possible save any changes down to the external file when the panel looses focus. I am going off of memory, but I added similar functionality to a plugin I build for my employer which would lookup a prepared sal statement and display the code used to create the prepared statement. I even allows users to make changes in the output panel and updated the prepared statement inplace. This saves us from having to leave our current location to update the prepared statement.

If I get a second I’ll post an quick example…after I update some thing’s in another plugin.[/quote]

Thanks for replying to me. I am currently going the way of ColorPicker and running a subprocess call (shell scripting) to another python program which runs from terminal using the default system interpreter, thus allowing me to import any python module that has been installed on the system. I found Tkinter nice and I’m currently trying to implement a GUI with that. Still encountering some problems with respect to passing of a data structure so wanted to try and install Tkinter using pip in a custom directory. Tkinter is not supported by pip, so hit a dead end there.

0 Likes

#5

tkinter is part of the stdlib but may not be available on all unix platforms (refer to docs). It’s not bundled by Sublime Text though.

0 Likes