def _on_work_dir_changed(self): """Handle an attempt to select a new work dir in the _work_dir_edit text editor""" new_dir = self._work_dir_edit.text() self._file_system_model.setRootPath(new_dir) if not os.path.isdir(new_dir): palette = self._work_dir_edit.palette() palette.setColor(QtGui.QPalette.Base, QtGui.QColor(255, 50, 50)) self._work_dir_edit.setPalette(palette) return new_dir = self._work_dir_edit.text() os.chdir(new_dir) palette = self._work_dir_edit.palette() palette.setColor(QtGui.QPalette.Base, QtGui.QColor(255, 255, 255)) self._work_dir_edit.setPalette(palette) self.dirChanged.emit(new_dir)
def on_read_error(self): """Handle read error emits""" palette = self._work_dir_edit.palette() palette.setColor(QtGui.QPalette.Base, QtGui.QColor(255, 250, 50)) self._work_dir_edit.setPalette(palette)