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 gettext 24 25 import gtk 26 27 from flumotion.common import errors, format 28 29 from flumotion.component.base.admin_gtk import BaseAdminGtk 30 from flumotion.component.base.baseadminnode import BaseAdminGtkNode 31 32 from flumotion.common.eventcalendar import LOCAL, UTC 33 34 _ = gettext.gettext 35 36 __version__ = "$Rev: 7587 $" 37 38 39 from kiwi.ui import objectlist 40 414358 5945 """ 46 @param when: a naive datetime representing UTC 47 @type when: L{datetime.datetime} 48 @type which: str 49 @type what: str 50 """ 51 self.when = when 52 # when is in UTC, but show it in local timezone instead 53 when = when.replace(tzinfo=UTC).astimezone(LOCAL) 54 55 self.whenLocal = format.formatTimeStamp(when.timetuple()) 56 self.which = which 57 self.what = what6185 8663 objectlist.ObjectList.__init__(self, [ 64 objectlist.Column("whenLocal", title=_("When")), 65 objectlist.Column("which", title=_("Which")), 66 objectlist.Column("what", title=_("What")), 67 ]) 68 self._parent = parent 69 self.setUIState(uiState)7072 self._uiState = uiState 73 self.clear() 74 for pointTuple in uiState.get('next-points'): 75 self.appendTuple(pointTuple)76 8082 for point in self: 83 if (point.when, point.which, point.what) == pointTuple: 84 self.remove(point)88 gladeFile = os.path.join('flumotion', 'component', 'consumers', 89 'disker', 'disker.glade') 90 91 currentFilenameLabel = None 92 currentFilenamePendingText = None 93 stopbutton = None 94 hasIcal = False 95201 20297 self.labels = {} 98 self.widget = self.wtree.get_widget('filename-widget') 99 self.currentFilenameLabel = self.wtree.get_widget('label-current') 100 if self.currentFilenamePendingText: 101 self.currentFilenameLabel.set_text(self.currentFilenamePendingText) 102 newbutton = self.wtree.get_widget('button-new') 103 newbutton.connect('clicked', self.cb_changefile_button_clicked) 104 self.stopbutton = self.wtree.get_widget('button-stop') 105 self.stopbutton.connect('clicked', self.cb_stop_button_clicked) 106 if self.hasIcal: 107 self.addScheduleWidget() 108 self.addNextPointsWidget()109 113115 self.warning("Failure %s changing filename: %s" % ( 116 failure.type, failure.getErrorMessage())) 117 return None118 122124 self.warning("Failure %s stopping recording: %s" % ( 125 failure.type, failure.getErrorMessage())) 126 return None127129 BaseAdminGtkNode.setUIState(self, state) 130 self.stateSet(state, 'filename', state.get('filename')) 131 self.stateSet(state, 'recording', state.get('recording')) 132 self.stateSet(state, 'can-schedule', state.get('can-schedule'))133135 if key == 'filename': 136 if self.currentFilenameLabel: 137 self.currentFilenameLabel.set_text(value or '<waiting>') 138 else: 139 self.currentFilenamePendingText = value 140 if key == 'recording': 141 if not value: 142 if self.currentFilenameLabel: 143 self.currentFilenameLabel.set_text('None') 144 else: 145 self.currentFilenamePendingText = "None" 146 if self.stopbutton: 147 self.stopbutton.set_sensitive(value) 148 if key == 'can-schedule' and value: 149 self.hasIcal = True 150 if self.widget: 151 self.addScheduleWidget() 152 self.addNextPointsWidget()153 157 161163 self.filechooser = gtk.FileChooserButton("Upload a schedule") 164 self.filechooser.set_local_only(True) 165 self.filechooser.set_action(gtk.FILE_CHOOSER_ACTION_OPEN) 166 filefilter = gtk.FileFilter() 167 filefilter.add_pattern("*.ics") 168 filefilter.set_name("vCalendar files") 169 self.filechooser.add_filter(filefilter) 170 self.filechooser.show() 171 scheduleButton = gtk.Button("Schedule recordings") 172 scheduleButton.show() 173 scheduleButton.connect("clicked", self.cb_schedule_recordings) 174 self.widget.attach(scheduleButton, 0, 1, 1, 2, 175 xoptions=0, yoptions=0, xpadding=6, ypadding=6) 176 self.widget.attach(self.filechooser, 1, 2, 1, 2, 177 xoptions = gtk.EXPAND|gtk.FILL, yoptions=0, xpadding=6, ypadding=6)178180 self._pointList = PointList(self.widget, self.uiState) 181 self.widget.attach(self._pointList, 0, 2, 3, 4, 182 xoptions=gtk.FILL, yoptions=gtk.FILL | gtk.EXPAND, 183 xpadding=6, ypadding=6) 184 self._pointList.show()185187 filename = self.filechooser.get_filename() 188 self.debug("filename is %r, uri %r, %r", filename, 189 self.filechooser.get_uri(), self.filechooser) 190 if filename: 191 icsStr = open(filename, "rb").read() 192 d = self.callRemote("scheduleRecordings", icsStr) 193 d.addErrback(self.scheduleRecordingsErrback) 194 else: 195 self.warning("No filename selected")196204209 210 GUIClass = DiskerAdminGtk 211206 filename = FilenameNode(self.state, self.admin, _("Filename")) 207 self.nodes['Filename'] = filename 208 return BaseAdminGtk.setup(self)
Trees | Indices | Help |
---|
Generated by Epydoc 3.0.1 on Sun Sep 13 13:20:14 2009 | http://epydoc.sourceforge.net |