Changeset 1ff29a
- Timestamp:
- 02/16/2009 11:27:12 PM (16 years ago)
- Branches:
- 2.0.x, develop, extjs4-port, master
- Children:
- cc272d
- Parents:
- b6dee7
- Location:
- deluge/ui/web
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
deluge/ui/web/js/deluge-connections.js
rb6dee7 r1ff29a 2 2 onClose: function(e) { 3 3 $clear(Deluge.Connections.running); 4 Deluge.Connections.Window.hide(); 4 5 }, 5 6 6 7 onConnect: function(e) { 8 $clear(Deluge.Connections.running); 9 Deluge.Connections.Window.hide(); 10 var selected = Deluge.Connections.Grid.getSelectionModel().getSelected(); 11 var id = selected.id; 12 Deluge.Client.web.connect(id, { 13 onSuccess: function(methods) { 14 Deluge.Client = new JSON.RPC('/json', { 15 methods: methods 16 }); 17 Deluge.Ui.run(); 18 } 19 }); 7 20 }, 21 22 onSelect: function(selModel, rowIndex, record) { 23 Deluge.Connections.selectedRow = rowIndex; 24 }, 8 25 9 26 onShow: function(window) { … … 20 37 onGetHosts: function(hosts) { 21 38 Deluge.Connections.Store.loadData(hosts); 39 var selection = Deluge.Connections.Grid.getSelectionModel(); 40 selection.selectRow(Deluge.Connections.selectedRow); 22 41 } 23 42 } … … 29 48 {name: 'port', mapping: 2}, 30 49 {name: 'version', mapping: 6} 31 ] 50 ], 51 id: 0 32 52 }); 33 53 … … 45 65 ], 46 66 stripeRows: true, 67 selModel: new Ext.grid.RowSelectionModel({ 68 singleSelect: true, 69 listeners: {'rowselect': Deluge.Connections.onSelect} 70 }), 47 71 autoExpandColumn: 'host', 48 72 deferredRender:false, … … 70 94 }], 71 95 listeners: { 96 'hide': Deluge.Connections.onClose, 72 97 'show': Deluge.Connections.onShow 73 98 } -
deluge/ui/web/js/deluge-ui.js
rb6dee7 r1ff29a 68 68 }); 69 69 Deluge.Torrents.store.loadData(torrents); 70 this.updateStatusBar(data['stats']);70 //this.updateStatusBar(data['stats']); 71 71 this.errorCount = 0; 72 72 }, -
deluge/ui/web/server.py
rb6dee7 r1ff29a 147 147 "web.add_torrents": self.add_torrents, 148 148 "web.login": self.login, 149 "web.get_hosts": self.get_hosts 149 "web.get_hosts": self.get_hosts, 150 "web.connect": self.connect 150 151 } 151 152 for entry in open(common.get_default_config_dir("auth")): … … 161 162 self.local_password = password 162 163 163 def connect(self, host="localhost", port=58846, username=None, password=None):164 def _connect(self, host="localhost", port=58846, username=None, password=None): 164 165 """ 165 166 Connects the client to a daemon … … 167 168 username = username or self.local_username 168 169 password = password or self.local_password 169 d = client.connect(host=host, username=username, password=password) 170 d = Deferred() 171 _d = client.connect(host=host, username=username, password=password) 170 172 171 173 def on_get_methods(methods): … … 174 176 """ 175 177 self._remote_methods = methods 178 methods = list(self._remote_methods) 179 methods.extend(self._local_methods) 180 d.callback(methods) 176 181 177 182 def on_client_connected(connection_id): … … 182 187 d = client.daemon.get_method_list() 183 188 d.addCallback(on_get_methods) 184 d.addCallback(on_client_connected) 189 _d.addCallback(on_client_connected) 190 return d 185 191 186 192 def _exec_local(self, method, params): … … 294 300 except Exception, e: 295 301 return self._on_json_request_failed(e, request) 302 303 def connect(self, host_id): 304 d = Deferred() 305 def on_connected(methods): 306 d.callback(methods) 307 for host in hostlist["hosts"]: 308 if host_id != host[0]: 309 continue 310 self._connect(*host[1:]).addCallback(on_connected) 311 return d 296 312 297 313 def update_ui(self, keys, filter_dict, cache_id=None): … … 407 423 408 424 def on_connect_failed(reason, host_id): 409 print reason425 log.exception(reason) 410 426 hosts[host_id][5] = _("Offline") 411 427 run_check()
Note:
See TracChangeset
for help on using the changeset viewer.