jdahlin - r7189 - in flumotion/trunk: . data/glade flumotion/ui
flumotion/wizard
flumotion-commit at lists.fluendo.com
flumotion-commit at lists.fluendo.com
Tue Aug 5 15:04:20 CEST 2008
Author: jdahlin
Date: Tue Aug 5 15:04:19 2008
New Revision: 7189
Log:
2008-08-05 Johan Dahlin <johan at flumotion.com>
* flumotion/ui/fileselector.py:
Add a getDirectory method and use it from
the getFilename method. This will have
* flumotion/wizard/diskersteps.py:
Move the registerVFSJelly from here to the fileselector.
* data/glade/disker-wizard.glade:
* flumotion/wizard/ondemandstep.py:
Use the file selector for the disker.
Modified:
flumotion/trunk/ChangeLog
flumotion/trunk/data/glade/disker-wizard.glade
flumotion/trunk/flumotion/ui/fileselector.py
flumotion/trunk/flumotion/wizard/diskersteps.py
flumotion/trunk/flumotion/wizard/ondemandstep.py
Modified: flumotion/trunk/ChangeLog
==============================================================================
--- flumotion/trunk/ChangeLog (original)
+++ flumotion/trunk/ChangeLog Tue Aug 5 15:04:19 2008
@@ -1,3 +1,17 @@
+2008-08-05 Johan Dahlin <johan at flumotion.com>
+
+ * flumotion/ui/fileselector.py:
+ Add a getDirectory method and use it from
+ the getFilename method. This will have
+
+ * flumotion/wizard/diskersteps.py:
+ Move the registerVFSJelly from here to the fileselector.
+
+ * data/glade/disker-wizard.glade:
+ * flumotion/wizard/ondemandstep.py:
+ Use the file selector for the disker.
+ Fixes #1054.
+
2008-08-05 Thomas Vander Stichele <thomas at apestaart dot org>
* common/pep8.py (added):
Modified: flumotion/trunk/data/glade/disker-wizard.glade
==============================================================================
--- flumotion/trunk/data/glade/disker-wizard.glade (original)
+++ flumotion/trunk/data/glade/disker-wizard.glade Tue Aug 5 15:04:19 2008
@@ -34,35 +34,6 @@
<property name="column_spacing">6</property>
<child>
- <widget class="GtkLabel" id="location_label">
- <property name="visible">True</property>
- <property name="label" translatable="yes">_Choose location:</property>
- <property name="use_underline">True</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_LEFT</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- <property name="mnemonic_widget">location</property>
- <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
- <property name="width_chars">-1</property>
- <property name="single_line_mode">False</property>
- <property name="angle">0</property>
- </widget>
- <packing>
- <property name="left_attach">0</property>
- <property name="right_attach">1</property>
- <property name="top_attach">0</property>
- <property name="bottom_attach">1</property>
- <property name="x_options">fill</property>
- <property name="y_options"></property>
- </packing>
- </child>
-
- <child>
<widget class="GtkTable" id="table2">
<property name="visible">True</property>
<property name="n_rows">2</property>
@@ -82,7 +53,7 @@
<property name="active">True</property>
<property name="inconsistent">False</property>
<property name="draw_indicator">True</property>
- <signal name="toggled" handler="on_has_time_toggled" last_modification_time="Thu, 30 Sep 2004 14:54:10 GMT"/>
+ <signal name="toggled" handler="on_has_time__toggled" last_modification_time="Thu, 30 Sep 2004 14:54:10 GMT"/>
</widget>
<packing>
<property name="left_attach">0</property>
@@ -106,7 +77,7 @@
<property name="inconsistent">False</property>
<property name="draw_indicator">True</property>
<property name="group">has_time</property>
- <signal name="toggled" handler="on_has_size_toggled" last_modification_time="Thu, 30 Sep 2004 14:42:57 GMT"/>
+ <signal name="toggled" handler="on_has_size__toggled" last_modification_time="Thu, 30 Sep 2004 14:42:57 GMT"/>
</widget>
<packing>
<property name="left_attach">0</property>
@@ -205,28 +176,6 @@
</child>
<child>
- <widget class="GtkEntry" id="directory">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="editable">True</property>
- <property name="visibility">True</property>
- <property name="max_length">0</property>
- <property name="text">/tmp</property>
- <property name="has_frame">True</property>
- <property name="invisible_char">*</property>
- <property name="activates_default">False</property>
- </widget>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- <property name="top_attach">0</property>
- <property name="bottom_attach">1</property>
- <property name="x_options">fill</property>
- <property name="y_options"></property>
- </packing>
- </child>
-
- <child>
<widget class="GtkAlignment" id="alignment1">
<property name="visible">True</property>
<property name="xalign">0</property>
@@ -249,7 +198,7 @@
<property name="active">True</property>
<property name="inconsistent">False</property>
<property name="draw_indicator">True</property>
- <signal name="toggled" handler="on_rotate_toggled" last_modification_time="Thu, 30 Sep 2004 14:42:47 GMT"/>
+ <signal name="toggled" handler="on_rotate__toggled" last_modification_time="Thu, 30 Sep 2004 14:42:47 GMT"/>
</widget>
</child>
</widget>
@@ -284,6 +233,103 @@
<property name="y_options"></property>
</packing>
</child>
+
+ <child>
+ <widget class="GtkFrame" id="frame1">
+ <property name="visible">True</property>
+ <property name="label_xalign">0</property>
+ <property name="label_yalign">0.5</property>
+ <property name="shadow_type">GTK_SHADOW_NONE</property>
+
+ <child>
+ <widget class="GtkAlignment" id="alignment2">
+ <property name="visible">True</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xscale">1</property>
+ <property name="yscale">1</property>
+ <property name="top_padding">0</property>
+ <property name="bottom_padding">0</property>
+ <property name="left_padding">12</property>
+ <property name="right_padding">0</property>
+
+ <child>
+ <widget class="GtkHBox" id="hbox1">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">0</property>
+
+ <child>
+ <widget class="GtkEntry" id="directory">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="editable">True</property>
+ <property name="visibility">True</property>
+ <property name="max_length">0</property>
+ <property name="text">/tmp</property>
+ <property name="has_frame">True</property>
+ <property name="invisible_char">*</property>
+ <property name="activates_default">False</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkButton" id="select">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes">_Select</property>
+ <property name="use_underline">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="focus_on_click">True</property>
+ <signal name="clicked" handler="on_select__clicked" last_modification_time="Tue, 05 Aug 2008 08:40:24 GMT"/>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+ </widget>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="label1">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">_Choose location:</property>
+ <property name="use_underline">True</property>
+ <property name="use_markup">True</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+ <property name="width_chars">-1</property>
+ <property name="single_line_mode">False</property>
+ <property name="angle">0</property>
+ </widget>
+ <packing>
+ <property name="type">label_item</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">0</property>
+ <property name="bottom_attach">1</property>
+ <property name="x_options">fill</property>
+ </packing>
+ </child>
</widget>
<packing>
<property name="padding">0</property>
Modified: flumotion/trunk/flumotion/ui/fileselector.py
==============================================================================
--- flumotion/trunk/flumotion/ui/fileselector.py (original)
+++ flumotion/trunk/flumotion/ui/fileselector.py Tue Aug 5 15:04:19 2008
@@ -38,7 +38,7 @@
from flumotion.common.errors import AccessDeniedError
from flumotion.common.interfaces import IDirectory, IFile
-from flumotion.common.vfs import listDirectory
+from flumotion.common.vfs import listDirectory, registerVFSJelly
_ = gettext.gettext
@@ -80,6 +80,8 @@
self._parent = parent
self._workerName = None
self._iconTheme = gtk.icon_theme_get_default()
+ self._path = None
+ registerVFSJelly()
def _rowActivated(self, vfsFile):
vfsFile = vfsFile.original
@@ -104,24 +106,37 @@
# Callbacks
- def _listingDoneCallback(self, vfsFile):
+ def _listingDoneCallback(self, vfsFile, path):
d = vfsFile.getFiles()
- d.addCallback(self._gotFilesCallback)
+ d.addCallback(self._gotFilesCallback, path)
d.addErrback(self._accessDeniedErrback, vfsFile.getPath())
def _accessDeniedErrback(self, failure, path):
failure.trap(AccessDeniedError)
self.showErrorMessage(failure, self._parent)
- def _gotFilesCallback(self, vfsFiles):
+ def _gotFilesCallback(self, vfsFiles, path):
vfsFiles.sort(cmp=lambda a, b: cmp(a.filename, b.filename))
self._populateList(vfsFiles)
+ self._path = path
def _on__row_activated(self, objectList, vfsFile):
self._rowActivated(vfsFile)
# Public API
+ def getDirectory(self):
+ """Get the currently selected directory from the file selector.
+ If there is no selected, the current path will be returned
+ @returns: the directory
+ @rtype: str
+ """
+ selected = self.get_selected()
+ if selected is None:
+ return self._path
+
+ return selected.getPath()
+
def setDirectory(self, path):
"""Change directory of the file chooser
@param path: the path to show in the file selector
@@ -130,7 +145,7 @@
d = self._adminModel.workerCallRemote(
self._workerName,
'listDirectory', path)
- d.addCallback(self._listingDoneCallback)
+ d.addCallback(self._listingDoneCallback, path)
d.addErrback(self._accessDeniedErrback, path)
return d
@@ -161,12 +176,12 @@
self.add_button(gtk.STOCK_OPEN, gtk.RESPONSE_OK)
self.selector = FileSelector(parent, adminModel)
- self.selector.connect('selected',
- self._on_file_selector__selected)
+ self.selector.connect(
+ 'selected', self._on_file_selector__selected)
self.vbox.add(self.selector)
self.selector.show()
- def _on_file_selector__selected(self, selector, vfsfile):
+ def _on_file_selector__selected(self, selector, vfsFile):
self.response(gtk.RESPONSE_OK)
def getFilename(self):
@@ -174,8 +189,9 @@
@returns: the selected filename
@rtype: str
"""
- vfsFile = self.selector.get_selected()
- return os.path.abspath(vfsFile.getPath())
+ # FIXME: This will change when we have multiple
+ # modes for selecting a file/directory
+ return self.selector.getDirectory()
def setDirectory(self, path):
"""Change directory of the file chooser
Modified: flumotion/trunk/flumotion/wizard/diskersteps.py
==============================================================================
--- flumotion/trunk/flumotion/wizard/diskersteps.py (original)
+++ flumotion/trunk/flumotion/wizard/diskersteps.py Tue Aug 5 15:04:19 2008
@@ -21,6 +21,9 @@
import gettext
+import gtk
+
+from flumotion.ui.fileselector import FileSelectorDialog
from flumotion.wizard.models import Consumer
from flumotion.wizard.basesteps import ConsumerStep
@@ -59,7 +62,7 @@
self.size_unit = SIZE_KB
self.time = 12
self.time_unit = TIME_HOUR
- self.properties.directory = ""
+ self.properties.directory = "/tmp"
def _getRotationType(self):
if self.has_time:
@@ -127,7 +130,7 @@
'size_unit',
'time_unit'])
- self.add_proxy(self.model.properties,
+ self._proxy = self.add_proxy(self.model.properties,
['directory',
'start_recording',
'size',
@@ -152,17 +155,38 @@
self.time.set_sensitive(hasTime)
self.time_unit.set_sensitive(hasTime)
+ def _select(self):
+
+ def response(fs, response):
+ fs.hide()
+ if response == gtk.RESPONSE_OK:
+ self.model.properties.directory = fs.getFilename()
+ self._proxy.update('directory')
+
+ def deleteEvent(fs, event):
+ pass
+ fs = FileSelectorDialog(self.wizard.window,
+ self.wizard.getAdminModel())
+ fs.connect('response', response)
+ fs.connect('delete-event', deleteEvent)
+ fs.selector.setWorkerName(self.model.worker)
+ fs.setDirectory(self.model.properties.directory)
+ fs.show_all()
+
# Callbacks
- def on_has_time_toggled(self, radio):
+ def on_has_time__toggled(self, radio):
self._updateRadio()
- def on_has_size_toggled(self, radio):
+ def on_has_size__toggled(self, radio):
self._updateRadio()
- def on_rotate_toggled(self, check):
+ def on_rotate__toggled(self, check):
self._updateRadio()
+ def on_select__clicked(self, check):
+ self._select()
+
class DiskBothStep(DiskStep):
name = 'Disk (audio & video)'
Modified: flumotion/trunk/flumotion/wizard/ondemandstep.py
==============================================================================
--- flumotion/trunk/flumotion/wizard/ondemandstep.py (original)
+++ flumotion/trunk/flumotion/wizard/ondemandstep.py Tue Aug 5 15:04:19 2008
@@ -30,7 +30,6 @@
from flumotion.common import messages
from flumotion.common.i18n import N_, gettexter
-from flumotion.common.vfs import registerVFSJelly
from flumotion.ui.fileselector import FileSelectorDialog
from flumotion.wizard.models import HTTPServer
from flumotion.wizard.workerstep import WorkerWizardStep
@@ -87,7 +86,6 @@
'mount_point'])
self.mount_point.set_text("/")
- registerVFSJelly()
def workerChanged(self, worker):
self.model.worker = worker
More information about the flumotion-commit
mailing list