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 3537 glade_file = 'connections.glade' 38 39 (STR_COL, 40 FILE_COL, 41 STATE_COL) = range(3) 42 43 model = None 44 gsignal('has-selection', bool) 45 gsignal('connection-activated', object) 46 47 treeview_connections = None 48120 pygobject.type_register(Connections) 121 12250 GladeWidget.__init__(self) 51 v = self.treeview_connections 52 53 c = gtk.TreeViewColumn('Host', gtk.CellRendererText(), 54 text=self.STR_COL) 55 v.append_column(c) 56 57 self._populate_liststore() 58 v.set_model(self.model) 59 60 # Bizarre. This doesn't work at all. 61 #self.scrolledwindow1.set_property('can-focus', False) 62 63 self.connect('grab-focus', self.on_grab_focus) 64 65 s = self.treeview_connections.get_selection() 66 s.set_mode(gtk.SELECTION_SINGLE) 67 if self.model.get_iter_first(): 68 s.select_path((0,)) 69 self.emit('has-selection', True) 70 else: 71 self.emit('has-selection', False)7274 self.model = gtk.ListStore(str, str, object) 75 for x in connections.get_recent_connections(): 76 i = self.model.append() 77 self.model.set(i, self.STR_COL, x['name'], self.FILE_COL, x['file'], 78 self.STATE_COL, x['info'])79 8385 v = self.treeview_connections 86 model, i = v.get_selection().get_selected() 87 if model: 88 v.scroll_to_cell(model[i].path, None, True, 0.5, 0) 89 v.grab_focus() 90 return True9193 m = self.model 94 i = m.get_iter_first() 95 while i: 96 self._clear_iter(i) 97 i = m.get_iter_first() 98 self.emit('has-selection', False)99101 s = self.treeview_connections.get_selection() 102 model, i = s.get_selected() 103 if i: 104 self._clear_iter(i) 105 if model.get_iter_first(): 106 s.select_path((0,)) 107 else: 108 self.emit('has-selection', False)109 112114 s = self.treeview_connections.get_selection() 115 model, i = s.get_selected() 116 if i: 117 return model.get_value(i, self.STATE_COL) 118 else: 119 return None124 glade_file = 'connection-dialog.glade' 125 126 gsignal('have-connection', object) 127143 144 pygobject.type_register(ConnectionsDialog) 145 146129 self.widgets['button_ok'].set_sensitive(has_selection)130 133 136 140148 glade_file = 'open-connection.glade' 149 150 gproperty(bool, 'can-activate', 'If the state of the widget is complete', 151 False) 152186 pygobject.type_register(OpenConnection) 187 188154 self.host_entry = self.port_entry = self.ssl_check = None 155 GladeWidget.__init__(self) 156 self.set_property('can-activate', False) 157 self.on_entries_changed() 158 self.connect('grab-focus', self.on_grab_focus)159 163165 old_can_act = self.get_property('can-activate') 166 can_act = self.host_entry.get_text() and self.port_entry.get_text() 167 # fixme: validate input 168 if old_can_act != can_act: 169 self.set_property('can-activate', can_act)170172 if button.get_active(): 173 self.port_entry.set_text('7531') 174 else: 175 self.port_entry.set_text('8642')176178 self.host_entry.set_text(state['host']) 179 self.port_entry.set_text(str(state['port'])) 180 self.ssl_check.set_active(not state['use_insecure'])181190 glade_file = 'authenticate.glade' 191 192 gproperty(bool, 'can-activate', 'If the state of the widget is complete', 193 False) 194 195 # pychecker sacrifices 196 auth_method_combo = None 197 user_entry = None 198 passwd_entry = None 199226 pygobject.type_register(Authenticate) 227201 GladeWidget.__init__(self, *args) 202 self.auth_method_combo.set_active(0) 203 self.set_property('can-activate', False) 204 self.user_entry.connect('activate', 205 lambda *x: self.passwd_entry.grab_focus()) 206 self.connect('grab-focus', self.on_grab_focus)207209 self.user_entry.grab_focus()210212 can_act = self.user_entry.get_text() and self.passwd_entry.get_text() 213 self.set_property('can-activate', can_act)214216 if state and 'user' in state: 217 self.user_entry.set_text(state['user']) 218 self.passwd_entry.set_text(state['passwd']) 219 else: 220 self.user_entry.set_text('') 221 self.passwd_entry.set_text('')222
Trees | Indices | Help |
---|
Generated by Epydoc 3.0.1 on Thu Aug 7 15:02:45 2008 | http://epydoc.sourceforge.net |