+ def _on_contact_import(self, *args):
+ try:
+ csvFilter = gtk.FileFilter()
+ csvFilter.set_name("Contacts")
+ csvFilter.add_pattern("*.csv")
+ importFileChooser = gtk.FileChooserDialog(
+ title="Contacts",
+ parent=self._window,
+ )
+ importFileChooser.add_button(gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL)
+ importFileChooser.add_button(gtk.STOCK_OK, gtk.RESPONSE_OK)
+
+ importFileChooser.set_property("filter", csvFilter)
+ userResponse = importFileChooser.run()
+ importFileChooser.hide()
+ if userResponse == gtk.RESPONSE_OK:
+ filename = importFileChooser.get_filename()
+ shutil.copy2(filename, self._fsContactsPath)
+ except Exception, e:
+ self._errorDisplay.push_exception()
+