11fs = require ' fs'
2- jquery = require (' atom' ).$
2+ $ = require (' atom' ).$
33process = require ' child_process'
44
55module .exports =
@@ -11,20 +11,23 @@ class PythonIsort
1111 return false
1212 return editor .getGrammar ().name == ' Python'
1313
14- removeStatusbarItem : - >
15- if not @ checkForPythonContext ()
16- jquery ( " #python-isort-status " ). remove ()
14+ removeStatusbarItem : = >
15+ @statusBarTile ? . destroy ()
16+ @statusBarTile = null
1717
18- updateStatusbarText : (message , isError ) - >
19- if jquery ( " #python-isort-status " ). length == 0
20- statusBar = atom . workspaceView . statusBar
18+ updateStatusbarText : (message , isError ) = >
19+ if not @statusBarTile
20+ statusBar = document . querySelector ( " status-bar " )
2121 return unless statusBar?
22- statusBar .appendLeft (' <div id="python-isort-status" class="inline-block">
23- <span style="font-weight: bold">Isort: </span>
24- <span id="python-isort-status-message"></span>
25- </div>' )
22+ @statusBarTile = statusBar
23+ .addLeftTile (
24+ item : $ (' <div id="status-bar-python-isort" class="inline-block">
25+ <span style="font-weight: bold">Isort: </span>
26+ <span id="python-isort-status-message"></span>
27+ </div>' ), priority : 100 )
2628
27- statusBarElement = jquery (" #python-isort-status-message" )
29+ statusBarElement = @statusBarTile .getItem ()
30+ .find (' #python-isort-status-message' )
2831
2932 if isError == true
3033 statusBarElement .addClass (" text-error" )
@@ -54,9 +57,9 @@ class PythonIsort
5457 updateStatusbarText = @updateStatusbarText
5558 proc .on ' exit' , (exit_code , signal ) ->
5659 if exit_code == 0
57- updateStatusbarText (" √ all python imports are fine " , false )
60+ updateStatusbarText (" √" , false )
5861 else
59- updateStatusbarText (" python imports are unsorted " , true )
62+ updateStatusbarText (" x " , true )
6063
6164 sortImports : ->
6265 if not @ checkForPythonContext ()
@@ -71,5 +74,5 @@ class PythonIsort
7174 return
7275
7376 proc = process .spawn isortpath, params
74- @ updateStatusbarText (" √ all python imports are fine " , false )
77+ @ updateStatusbarText (" √" , false )
7578 @reload
0 commit comments