GtkFileSelection.
def _onBrowse(self, *unused):
directorySelectedInDirList = False
- dirDialog = gtk.FileSelection(title="Choose directory")
- dirDialog.file_list.set_sensitive(False)
- dirDialog.fileop_del_file.set_sensitive(False)
- dirDialog.fileop_ren_file.set_sensitive(False)
+ dirDialog = gtk.FileChooserDialog(
+ title="Choose directory",
+ action=gtk.FILE_CHOOSER_ACTION_SELECT_FOLDER,
+ buttons=(
+ gtk.STOCK_OK, gtk.RESPONSE_OK,
+ gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL))
if dirDialog.run() == gtk.RESPONSE_OK:
- model, iterator = dirDialog.dir_list.get_selection().get_selected()
- directory = dirDialog.get_filename()
- if iterator:
- directory = os.path.join(
- directory, model.get_value(iterator, 0))
- self.directoryTextEntry.set_text(directory)
+ self.directoryTextEntry.set_text(dirDialog.get_filename())
dirDialog.destroy()
def _onCancel(self, *unused):
makeValidTag
from kofoto.clientutils import walk_files
-class HandleImagesDialog(gtk.FileSelection):
+class HandleImagesDialog(gtk.FileChooserDialog):
def __init__(self):
- gtk.FileSelection.__init__(self, title="Register images")
- self.set_select_multiple(True)
- self.ok_button.connect("clicked", self._ok)
+ gtk.FileChooserDialog.__init__(
+ self,
+ title="Handle images",
+ action=gtk.FILE_CHOOSER_ACTION_SELECT_FOLDER,
+ buttons=(
+ gtk.STOCK_OK, gtk.RESPONSE_OK,
+ gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL))
+ self.connect("response", self._response)
- def _ok(self, widget):
+ def _response(self, widget, responseId):
+ if responseId == gtk.RESPONSE_CANCEL:
+ return
widgets = gtk.glade.XML(env.gladeFile, "handleImagesProgressDialog")
handleImagesProgressDialog = widgets.get_widget(
"handleImagesProgressDialog")
investigatedFiles = 0
modifiedImages = []
movedImages = []
- for filepath in walk_files(self.get_selections()):
+ for filepath in walk_files([self.get_filename()]):
try:
filepath = filepath.decode("utf-8")
except UnicodeDecodeError:
from kofoto.shelf import ImageExistsError, NotAnImageError, makeValidTag
from kofoto.clientutils import walk_files
-class RegisterImagesDialog(gtk.FileSelection):
+class RegisterImagesDialog(gtk.FileChooserDialog):
def __init__(self, albumToAddTo=None):
- gtk.FileSelection.__init__(self, title="Register images")
+ gtk.FileChooserDialog.__init__(
+ self,
+ title="Register images",
+ action=gtk.FILE_CHOOSER_ACTION_SELECT_FOLDER,
+ buttons=(
+ gtk.STOCK_OK, gtk.RESPONSE_OK,
+ gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL))
self.__albumToAddTo = albumToAddTo
- self.set_select_multiple(True)
- self.ok_button.connect("clicked", self._ok)
+ self.connect("response", self._response)
- def _ok(self, widget):
+ def _response(self, widget, responseId):
+ if responseId == gtk.RESPONSE_CANCEL:
+ return
widgets = gtk.glade.XML(env.gladeFile, "registrationProgressDialog")
registrationProgressDialog = widgets.get_widget(
"registrationProgressDialog")
filesInvestigated = 0
images = []
registrationTimeString = unicode(time.strftime("%Y-%m-%d %H:%M:%S"))
- for filepath in walk_files(self.get_selections()):
+ for filepath in walk_files([self.get_filename()]):
try:
try:
filepath = filepath.decode("utf-8")