Changes between Version 10 and Version 11 of Development/1.2/Plugin
- Timestamp:
- 09/11/2009 03:56:43 PM (15 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Development/1.2/Plugin
v10 v11 176 176 177 177 client.myplugin.get_config().addCallback(on_get_config) 178 179 178 }}} 180 179 … … 194 193 "total_upload": 0 195 194 } 196 197 195 }}} 198 196 … … 218 216 self.config["total_upload"] = self.total_upload 219 217 self.config["total_download"] = self.total_download 220 221 218 }}} 222 219 … … 234 231 self.total_upload = self.config["total_upload"] + status["total_upload"] 235 232 self.total_download = self.config["total_download"] + status["total_download"] 236 237 233 }}} 238 234 … … 249 245 250 246 from twisted.internet.task import LoopingCall 251 252 247 }}} 253 248 … … 265 260 self.update_status_timer.start(2) 266 261 267 }}} 268 269 The syntax for the `LoopingCall` is simple, it just takes function you wish to call in the timer. Next, we simply `start()` the timer with a value in seconds that determines it's frequency, in this case the function will be called every 2 seconds. 270 262 def disable(self): 263 self.update_status_timer.stop() 264 265 self.config["total_upload"] = self.total_upload 266 self.config["total_download"] = self.total_download 267 }}} 268 269 The syntax for the `LoopingCall` is simple, it just takes function you wish to call in the timer. Next, we simply `start()` the timer with a value in seconds that determines it's frequency, in this case the function will be called every 2 seconds. In our `disable()` method we `stop()` the timer. 270