@@ -48,6 +48,12 @@ def clear(self) -> None:
4848 self .view .erase_status (self .key )
4949
5050
51+ class State (IntEnum ):
52+ STOPPED = 0
53+ STOPPING = 1
54+ RUNNING = 2
55+
56+
5157class ActivityIndicator :
5258 """
5359 An animated text-based indicator to show that some activity is in progress.
@@ -61,11 +67,6 @@ class ActivityIndicator:
6167 .. versionadded:: 1.4
6268 """
6369
64- class State (IntEnum ):
65- STOPPED = 0
66- STOPPING = 1
67- RUNNING = 2
68-
6970 frames : str | list [str ] = "⣷⣯⣟⡿⢿⣻⣽⣾"
7071 interval : int = 100
7172
@@ -84,7 +85,7 @@ def __init__(
8485 self ._target = target
8586
8687 self ._lock : Lock = Lock ()
87- self ._state : int = self . State .STOPPED
88+ self ._state : State = State .STOPPED
8889 self ._ticks : int = 0
8990 self ._tick_ref = weak_method (self ._tick )
9091
@@ -111,14 +112,14 @@ def start(self) -> None:
111112 :raise ValueError: if the indicator is already running.
112113 """
113114 with self ._lock :
114- if self ._state == self . State .RUNNING :
115+ if self ._state == State .RUNNING :
115116 raise ValueError ("Activity indicator is already running!" )
116- elif self ._state == self . State .STOPPING :
117- self ._state = self . State .RUNNING
117+ elif self ._state == State .STOPPING :
118+ self ._state = State .RUNNING
118119 else :
119120 self .update ()
120121 sublime .set_timeout (self ._tick_ref , self .interval )
121- self ._state = self . State .RUNNING
122+ self ._state = State .RUNNING
122123
123124 def stop (self ) -> None :
124125 """
@@ -127,16 +128,16 @@ def stop(self) -> None:
127128 If the indicator is not running, do nothing.
128129 """
129130 with self ._lock :
130- if self ._state != self . State .STOPPED :
131- self ._state = self . State .STOPPING
131+ if self ._state != State .STOPPED :
132+ self ._state = State .STOPPING
132133
133134 def _tick (self ) -> None :
134135 with self ._lock :
135- if self ._state == self . State .RUNNING :
136+ if self ._state == State .RUNNING :
136137 self .tick ()
137138 sublime .set_timeout (self ._tick_ref , self .interval )
138139 return
139- self ._state = self . State .STOPPED
140+ self ._state = State .STOPPED
140141 self ._target .clear ()
141142
142143 def tick (self ) -> None :
0 commit comments