Trees | Indices | Help |
---|
|
1 # -*- Mode: Python -*- 2 # vi:si:et:sw=4:sts=4:ts=4 3 # 4 # Flumotion - a streaming media server 5 # Copyright (C) 2004,2005,2006,2007 Fluendo, S.L. (www.fluendo.com). 6 # All rights reserved. 7 8 # This file may be distributed and/or modified under the terms of 9 # the GNU General Public License version 2 as published by 10 # the Free Software Foundation. 11 # This file is distributed without any warranty; without even the implied 12 # warranty of merchantability or fitness for a particular purpose. 13 # See "LICENSE.GPL" in the source distribution for more information. 14 15 # Licensees having purchased or holding a valid Flumotion Advanced 16 # Streaming Server license may use this file in accordance with th 17 # Flumotion Advanced Streaming Server Commercial License Agreement. 18 # See "LICENSE.Flumotion" in the source distribution for more information. 19 20 # Headers in this file shall remain intact. 21 22 23 import os 24 25 import gtk 26 import gtk.glade 27 import gobject 28 29 from flumotion.ui.glade import GladeWidget, GladeWindow 30 from flumotion.configure import configure 31 from flumotion.common import pygobject 32 from flumotion.common.pygobject import gsignal, gproperty 33 34 from flumotion.admin import connections 35 3638 glade_file = 'connections.glade' 39 40 STR_COL = 0 41 FILE_COL = 1 42 STATE_COL = 2 43 44 model = None 45 gsignal('has-selection', bool) 46 gsignal('connection-activated', object) 47 48 treeview_connections = None 49121 pygobject.type_register(Connections) 122 12351 GladeWidget.__init__(self) 52 v = self.treeview_connections 53 54 c = gtk.TreeViewColumn('Host', gtk.CellRendererText(), 55 text=self.STR_COL) 56 v.append_column(c) 57 58 self._populate_liststore() 59 v.set_model(self.model) 60 61 # Bizarre. This doesn't work at all. 62 #self.scrolledwindow1.set_property('can-focus', False) 63 64 self.connect('grab-focus', self.on_grab_focus) 65 66 s = self.treeview_connections.get_selection() 67 s.set_mode(gtk.SELECTION_SINGLE) 68 if self.model.get_iter_first(): 69 s.select_path((0,)) 70 self.emit('has-selection', True) 71 else: 72 self.emit('has-selection', False)7375 self.model = gtk.ListStore(str, str, object) 76 for x in connections.get_recent_connections(): 77 i = self.model.append() 78 self.model.set(i, self.STR_COL, x['name'], self.FILE_COL, x['file'], 79 self.STATE_COL, x['info'])80 8486 v = self.treeview_connections 87 model, i = v.get_selection().get_selected() 88 if model: 89 v.set_cursor(model.get_path(i), None, False) 90 self.treeview_connections.grab_focus() 91 return True9294 m = self.model 95 i = m.get_iter_first() 96 while i: 97 self._clear_iter(i) 98 i = m.get_iter_first() 99 self.emit('has-selection', False)100102 s = self.treeview_connections.get_selection() 103 model, i = s.get_selected() 104 if i: 105 self._clear_iter(i) 106 if model.get_iter_first(): 107 s.select_path((0,)) 108 else: 109 self.emit('has-selection', False)110 113115 s = self.treeview_connections.get_selection() 116 model, i = s.get_selected() 117 if i: 118 return model.get_value(i, self.STATE_COL) 119 else: 120 return None125 glade_file = 'connection-dialog.glade' 126 127 gsignal('have-connection', object) 128141 pygobject.type_register(ConnectionsDialog) 142 143130 self.widgets['button_ok'].set_sensitive(has_selection)131 134 137145 glade_file = 'open-connection.glade' 146 147 gproperty(bool, 'can-activate', 'If the state of the widget is complete', 148 False) 149183 pygobject.type_register(OpenConnection) 184 185151 self.host_entry = self.port_entry = self.ssl_check = None 152 GladeWidget.__init__(self) 153 self.set_property('can-activate', False) 154 self.on_entries_changed() 155 self.connect('grab-focus', self.on_grab_focus)156 160162 old_can_act = self.get_property('can-activate') 163 can_act = self.host_entry.get_text() and self.port_entry.get_text() 164 # fixme: validate input 165 if old_can_act != can_act: 166 self.set_property('can-activate', can_act)167169 if button.get_active(): 170 self.port_entry.set_text('7531') 171 else: 172 self.port_entry.set_text('8642')173175 self.host_entry.set_text(state['host']) 176 self.port_entry.set_text(str(state['port'])) 177 self.ssl_check.set_active(not state['use_insecure'])178187 glade_file = 'authenticate.glade' 188 189 gproperty(bool, 'can-activate', 'If the state of the widget is complete', 190 False) 191 192 # pychecker sacrifices 193 auth_method_combo = None 194 user_entry = None 195 passwd_entry = None 196223 pygobject.type_register(Authenticate) 224198 GladeWidget.__init__(self, *args) 199 self.auth_method_combo.set_active(0) 200 self.set_property('can-activate', False) 201 self.user_entry.connect('activate', 202 lambda *x: self.passwd_entry.grab_focus()) 203 self.connect('grab-focus', self.on_grab_focus)204206 self.user_entry.grab_focus()207209 can_act = self.user_entry.get_text() and self.passwd_entry.get_text() 210 self.set_property('can-activate', can_act)211213 if state and 'user' in state: 214 self.user_entry.set_text(state['user']) 215 self.passwd_entry.set_text(state['passwd']) 216 else: 217 self.user_entry.set_text('') 218 self.passwd_entry.set_text('')219
Trees | Indices | Help |
---|
Generated by Epydoc 3.0.1 on Fri Apr 11 07:40:41 2008 | http://epydoc.sourceforge.net |