def _add_clicked(self, button): dir = dialogs.ask_for_directory(_("Add Watched Folder"), initial_directory=app.config.get(prefs.MOVIES_DIRECTORY), transient_for=_pref_window) if dir is not None: app.watched_folder_manager.add(dir) self._check_no_folders()
def handle_change_clicked(widget): dir_ = dialogs.ask_for_directory( _("Choose directory to search for media files"), initial_directory=_get_user_media_directory(), transient_for=self) if dir_: search_entry.set_text(filename_to_unicode(dir_)) self.search_directory = dir_ else: self.search_directory = _get_user_media_directory()
def handle_change_clicked(widget): dir_ = dialogs.ask_for_directory( _("Choose directory to search for media files"), initial_directory=get_default_search_dir(), transient_for=self) if dir_: search_entry.set_text(filename_to_unicode(dir_)) self.search_directory = dir_ else: self.search_directory = get_default_search_dir() # reset the search results if they change the directory self.gathered_media_files = None
def handle_choose(self, widget): # 17407 band-aid - don't init with PlatformFilenameType since # str use ascii codec path = self.folder_entry.get_text() if PlatformFilenameType == str: path = path.encode('utf-8') if not os.path.exists(path): path = resources.get_default_search_dir() newpath = ask_for_directory(_("Choose Watched Folder Directory"), path) if newpath: self.folder_entry.set_text(newpath)
def _on_button_clicked(self, button): d = dialogs.ask_for_directory(_("Choose Movies Directory"), initial_directory=app.config.get(prefs.MOVIES_DIRECTORY), transient_for=_pref_window) if d is not None: try: if not os.path.exists(d): os.makedirs(d) if not os.access(d, os.W_OK): raise IOError # Pretend we got an IOError. except (OSError, IOError): dialogs.show_message(_("Directory not valid"), _("Directory '%s' could not be created. " + "Please choose a directory you have " + "write access to."), dialogs.WARNING_MESSAGE) return logging.info("Created directory. It's valid.") self.path = d self.label.set_text(filename_to_unicode(d))