| 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 the 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 import os 23 import gtk 24 25 from flumotion.common import errors 26 27 from flumotion.component.base.admin_gtk import BaseAdminGtk 28 from flumotion.component.base.baseadminnode import BaseAdminGtkNode 29 30 __version__ = "$Rev: 6784 $" 31 3234 gladeFile = os.path.join('flumotion', 'component', 'consumers', 35 'disker', 'disker.glade') 36 37 currentFilenameLabel = None 38 currentFilenamePendingText = None 39 stopbutton = None 40 hasIcal = False 4112943 self.labels = {} 44 self.widget = self.wtree.get_widget('filename-widget') 45 self.currentFilenameLabel = self.wtree.get_widget('label-current') 46 if self.currentFilenamePendingText: 47 self.currentFilenameLabel.set_text(self.currentFilenamePendingText) 48 newbutton = self.wtree.get_widget('button-new') 49 newbutton.connect('clicked',self.cb_changefile_button_clicked) 50 self.stopbutton = self.wtree.get_widget('button-stop') 51 self.stopbutton.connect('clicked', self.cb_stop_button_clicked) 52 if self.hasIcal: 53 self.addScheduleWidget()54 5860 self.warning("Failure %s changing filename: %s" % ( 61 failure.type, failure.getErrorMessage())) 62 return None63 6769 self.warning("Failure %s stopping recording: %s" % ( 70 failure.type, failure.getErrorMessage())) 71 return None7274 BaseAdminGtkNode.setUIState(self, state) 75 self.stateSet(state, 'filename', state.get('filename')) 76 self.stateSet(state, 'recording', state.get('recording')) 77 self.stateSet(state, 'can-schedule', state.get('can-schedule'))7880 if key == 'filename': 81 if self.currentFilenameLabel: 82 self.currentFilenameLabel.set_text(value or '<waiting>') 83 else: 84 self.currentFilenamePendingText = value 85 if key == 'recording': 86 if not value: 87 if self.currentFilenameLabel: 88 self.currentFilenameLabel.set_text('None') 89 else: 90 self.currentFilenamePendingText = "None" 91 if self.stopbutton: 92 self.stopbutton.set_sensitive(value) 93 if key == 'can-schedule' and value: 94 self.hasIcal = True 95 if self.widget: 96 self.addScheduleWidget()9799 self.filechooser = gtk.FileChooserButton("Upload a schedule") 100 self.filechooser.set_local_only(True) 101 self.filechooser.set_action(gtk.FILE_CHOOSER_ACTION_OPEN) 102 filefilter = gtk.FileFilter() 103 filefilter.add_pattern("*.ics") 104 filefilter.set_name("vCalendar files") 105 self.filechooser.add_filter(filefilter) 106 self.filechooser.show() 107 scheduleButton = gtk.Button("Schedule recordings") 108 scheduleButton.show() 109 scheduleButton.connect("clicked", self.cb_schedule_recordings) 110 self.widget.attach(scheduleButton, 0, 1, 1, 2, 111 xoptions=0, yoptions=0, xpadding=6, ypadding=6) 112 self.widget.attach(self.filechooser, 1, 2, 1, 2, 113 xoptions = gtk.EXPAND|gtk.FILL, yoptions=0, xpadding=6, ypadding=6)114116 filename = self.filechooser.get_filename() 117 self.debug("filename is %r, uri %r, %r", filename, self.filechooser.get_uri(), self.filechooser) 118 if filename: 119 icsStr = open(filename, "rb").read() 120 d = self.callRemote("scheduleRecordings", icsStr) 121 d.addErrback(self.scheduleRecordingsErrback) 122 else: 123 self.warning("No filename selected")124135 136 GUIClass = DiskerAdminGtk 137132 filename = FilenameNode(self.state, self.admin, "Filename") 133 self.nodes['Filename'] = filename 134 return BaseAdminGtk.setup(self)
| Trees | Indices | Help |
|---|
| Generated by Epydoc 3.0.1 on Sat Jul 26 09:43:11 2008 | http://epydoc.sourceforge.net |