| 3726 | def allow_folder_selection(self, value): self._allow_folder_selection = value |
| 3727 | |
| 3728 | def __init__(self, multiple_selection = False, selection_folder = ".", allow_file_selection = True, allow_folder_selection = False, **kwargs): |
| 3729 | super(FileFolderNavigator, self).__init__(**kwargs) |
| 3730 | |
| 3731 | self.css_grid_template_columns = "30px auto 30px" |
| 3732 | self.css_grid_template_rows = "30px auto" |
| 3733 | self.define_grid([('button_back','url_editor','button_go'), ('items','items','items')]) |
| 3734 | |
| 3735 | self.multiple_selection = multiple_selection |
| 3736 | self.allow_file_selection = allow_file_selection |
| 3737 | self.allow_folder_selection = allow_folder_selection |
| 3738 | self.selectionlist = [] |
| 3739 | self.currDir = '' |
| 3740 | self.controlBack = Button('Up') |
| 3741 | self.controlBack.onclick.connect(self.dir_go_back) |
| 3742 | self.controlGo = Button('Go >>') |
| 3743 | self.controlGo.onclick.connect(self.dir_go) |
| 3744 | self.pathEditor = TextInput() |
| 3745 | self.pathEditor.style['resize'] = 'none' |
| 3746 | self.pathEditor.attributes['rows'] = '1' |
| 3747 | self.append(self.controlBack, "button_back") |
| 3748 | self.append(self.pathEditor, "url_editor") |
| 3749 | self.append(self.controlGo, "button_go") |
| 3750 | |
| 3751 | self.itemContainer = Container(width='100%', height='100%') |
| 3752 | |
| 3753 | self.append(self.itemContainer, key='items') # defined key as this is replaced later |
| 3754 | |
| 3755 | self.folderItems = list() |
| 3756 | |
| 3757 | self.selection_folder = selection_folder |
| 3758 | |
| 3759 | def get_selection_list(self): |
| 3760 | if self.allow_folder_selection and not self.selectionlist: |