Kodi Community Forum

Full Version: KodiDevKit: SublimeText3 plugin to support kodi skinning / scripting
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
no, at least not on Linux and Windows non-portable.
...and more features:
- Added "move to language file" to context menu (creates entry in strings.po using the first free id and replaces selected text with $LOCAIZE[])
- Added "Execute Builtin" to command palette.
- show value of selected Kodi InfoLabel in tooltip (by using JSON-RPC)
- show infos for selected image (image dimensions and file size)
- added some new settings (adjustable tooltip dimensions for example)
(2015-05-03, 00:03)phil65 Wrote: [ -> ]...and more features:
- Added "move to language file" to context menu (creates entry in strings.po using the first free id and replaces selected text with $LOCAIZE[])

Wow, looking forward to testing this one!
Well it's getting re-created here, but other packages I use don't, so I'd say it is controllable somehow. If I delete the .package & restart it immediately says
Code:
Package Control: Installing 1 missing package
Package Control: Installed missing package SublimeKodi
Package Control: Skipping automatic upgrade, last run at 2015-05-03 09:27:03, next run at 2015-05-03 10:27:03 or after
reloading plugin SublimeKodi.__init__
reloading plugin SublimeKodi.sublimekodi
Traceback (most recent call last):
  File "C:\Utilities\Sublime Text\sublime_plugin.py", line 74, in reload_plugin
    m = importlib.import_module(modulename)
  File "./importlib/__init__.py", line 90, in import_module
  File "<frozen importlib._bootstrap>", line 1584, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1565, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1532, in _find_and_load_unlocked
  File "C:\Utilities\Sublime Text\sublime_plugin.py", line 678, in load_module
    exec(compile(source, source_path, 'exec'), mod.__dict__)
  File "sublimekodi in C:\Utilities\Sublime Text\Data\Installed Packages\SublimeKodi.sublime-package", line 13, in <module>
ImportError: No module named 'polib'
generating syntax summary

Here is, for example, one which includes binaries for three platforms and does not create a sublime-package zip:
https://github.com/weslly/ColorPicker

(which is all the are, so it's perhaps just a path issue??)

I ran the portable version for ages simply because at the time it made syncing installations much easier. It'd be a pain to change now given I use it on >5 machines this way...but not impossible I guess. Still, I have no other issues with packages and portable, including at least a few that provide binaries.
you could try adding a " .no-sublime-package" file to the plugin root.
syncing can still be done in a very easy way by using symlinks.
I don't really have a plugin root as all I get is the .sublime-package it seems.

I tried creating SublimeKodi in my user packages folder and putting that .no-sublime-package but that didn't work and can't see anything acknowledging it in the console.

I understand these days you can sync ST3 without needing portable etc, but this dates back to ST2 days and I'd just have to change a bunch of stuff. Which is ok, of course, but I suspect over time it working with portable would be a good thing.

I think you would have to add the .no-sublime-package to your git repo actually, for that to work (like ColorPicker does it seems).
I think I found the reason for the import errors when stuff is put into .sublime-package files.
from https://docs.python.org/3.3/library/zipimport.html
"Any files may be present in the ZIP archive, but only files .py and .py[co] are available for import. ZIP import of dynamic modules (.pyd, .so) is disallowed."
So easiest solution to try is to put a .no-sublime-package in your repo perhaps?
I already did.
And yep that solves that issue, sorry it needed me to manually delete the .subime-package that already existed to kick it off.

Next issue - it's raising errors on project changes:
Code:
SublimeKodi: project change detected: W:\vhosts\ee\junk
Traceback (most recent call last):
  File "C:\Utilities\Sublime Text\sublime_plugin.py", line 312, in on_activated_async
    callback.on_activated_async(v)
  File "C:\Utilities\Sublime Text\Data\Packages\SublimeKodi\sublimekodi.py", line 139, in on_activated_async
    self.check_project_change()
  File "C:\Utilities\Sublime Text\Data\Packages\SublimeKodi\sublimekodi.py", line 172, in check_project_change
    Infos.update_include_list()
  File "C:\Utilities\Sublime Text\Data\Packages\SublimeKodi\libs\InfoProvider.py", line 73, in update_include_list
    for path in self.include_file_list:
TypeError: 'NoneType' object is not iterable
Package Control: No updated packages
Unable to open /C/XBMCStuff/GIT/repository.squeeze.bossanova808/staging/repo.xml
SublimeKodi: project change detected: C:\XBMCStuff\Kodi\portable_data\addons
Traceback (most recent call last):
  File "C:\Utilities\Sublime Text\sublime_plugin.py", line 312, in on_activated_async
    callback.on_activated_async(v)
  File "C:\Utilities\Sublime Text\Data\Packages\SublimeKodi\sublimekodi.py", line 139, in on_activated_async
    self.check_project_change()
  File "C:\Utilities\Sublime Text\Data\Packages\SublimeKodi\sublimekodi.py", line 172, in check_project_change
    Infos.update_include_list()
  File "C:\Utilities\Sublime Text\Data\Packages\SublimeKodi\libs\InfoProvider.py", line 73, in update_include_list
    for path in self.include_file_list:
TypeError: 'NoneType' object is not iterable

I use ST for many things obviosuly, not just Kodi, I get an error like that with any project change, appears to be looking at the latest folder added to the project at this point:
Switch to my kodi addons project:
SublimeKodi: project change detected: C:\XBMCStuff\Kodi\portable_data\addons
Back to a website project:
SublimeKodi: project change detected: W:\vhosts\ee\junk -> this is only one of many paths in the project, I think the last added one
yep I know about those, but they shouldnt really matter in terms of functionality. Will add some additional checks.

EDIT:
should be fixed now.
Yep, no exceptions now. Is the idea then one project per addon folder? I generally have used one project with a gti folder and my userdata addons folder ... this allows me to work on multiple addons at a time, as I have some that use a common module etc.

No biggie, just curious how you see/want it used?
One project for every addon, correct.
Feature list up to now:

Kodi Log:

- Open log from command palette
- Added syntax highlighting
- Jump to code where exception ocurred by pressing shift+enter when line with path is selected


Tooltips:

- Show english translation when label id is selected
- Show additional translation of choice when label id is selected
- show color hex value for color names
- show variable content
- show include content
- show font tag
- show constant value
- show value of selected Kodi InfoLabel in tooltip (by using JSON-RPC)
- show infos for selected image (image dimensions and file size)


JSON-RPC:

- auto-reload skin after saving xml
- Execute builtins from command palette


Shortcuts:

- jump to include (shift+enter)
- jump to variable (shift+enter)
- jump to constant (shift+enter)
- jump to font (shift+enter)
- jump to label definition (shift+enter)
- jump to color definition (shift+enter)
- preview skin image (ctrl+enter)


Fuzzy searches:

- Search through all skin labels
- Search through all textures including preview
- Search though all available fonts


Context menu:

- "move label to language file" (creates entry in strings.po using the first free id and replaces selected text with $LOCAIZE[])
Issues incoming Tongue

Reloading skin
PHP Code:
During handling of the above exceptionanother exception occurred:

Traceback (most recent call last):
  
File "C:\Users\ssaenger\Documents\GitHub\sublime\sublime_plugin.py"line 533in run_
    
return self.run(**args)
  
File "C:\Users\ssaenger\Documents\GitHub\sublime\Data\Packages\SublimeKodi\sublimekodi.py"line 216in run
    result 
kodi_json_request(data)
  
File "C:\Users\ssaenger\Documents\GitHub\sublime\Data\Packages\SublimeKodi\libs\Utils.py"line 97in kodi_json_request
    result 
urlopen(request)
  
File "./urllib/request.py"line 156in urlopen
  File 
"./urllib/request.py"line 469in open
  File 
"./urllib/request.py"line 487in _open
  File 
"./urllib/request.py"line 447in _call_chain
  File 
"./urllib/request.py"line 1268in http_open
  File 
"./urllib/request.py"line 1251in do_open
urllib
.error.URLError: <urlopen error [WinError 10061No connection could be made because the target machine actively refused it

BuildIn command
PHP Code:
During handling of the above exceptionanother exception occurred:

Traceback (most recent call last):
  
File "C:\Users\ssaenger\Documents\GitHub\sublime\sublime_plugin.py"line 533in run_
    
return self.run(**args)
  
File "C:\Users\ssaenger\Documents\GitHub\sublime\Data\Packages\SublimeKodi\sublimekodi.py"line 216in run
    result 
kodi_json_request(data)
  
File "C:\Users\ssaenger\Documents\GitHub\sublime\Data\Packages\SublimeKodi\libs\Utils.py"line 97in kodi_json_request
    result 
urlopen(request)
  
File "./urllib/request.py"line 156in urlopen
  File 
"./urllib/request.py"line 469in open
  File 
"./urllib/request.py"line 487in _open
  File 
"./urllib/request.py"line 447in _call_chain
  File 
"./urllib/request.py"line 1268in http_open
  File 
"./urllib/request.py"line 1251in do_open
urllib
.error.URLError: <urlopen error [WinError 10061No connection could be made because the target machine actively refused it

Move label to language file
PHP Code:
SublimeKodifirst free31000
Traceback 
(most recent call last):
  
File "C:\Users\ssaenger\Documents\GitHub\sublime\sublime_plugin.py"line 556in run_
    
return self.run(edit)
  
File "C:\Users\ssaenger\Documents\GitHub\sublime\Data\Packages\SublimeKodi\sublimekodi.py"line 426in run
    po
.save(INFOS.addon_lang_path)
  
File "C:\Users\ssaenger\Documents\GitHub\sublime\Data\Packages\SublimeKodi\libs\polib\polib.py"line 430in save
    fhandle 
io.open(fpath'w'encoding=self.encoding)
FileNotFoundError: [Errno 2No such file or directory'' 

I also noticed that the localized tooltip isn't shown anymore. But searching for labels works perfectly.

-> Win7, latest sublime3dev build non-portable, even tried running with admin rights.
Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22