def __init__(self, appInstance, **kwargs): super(UrlPathInput, self).__init__(**kwargs) gui.EventSource.__init__(self) self.appInstance = appInstance self.set_layout_orientation(gui.Widget.LAYOUT_HORIZONTAL) self.style['display'] = 'block' self.style['overflow'] = 'hidden' self.txtInput = StringEditor(width='80%', height='100%') self.txtInput.style['float'] = 'left' self.txtInput.onchange.connect(self.on_txt_changed) self.append(self.txtInput) self.btFileFolderSelection = gui.Widget(width='20%', height='100%') self.btFileFolderSelection.style.update({ 'background-repeat': 'round', 'background-image': "url('/res/folder.png')", 'background-color': 'transparent' }) self.append(self.btFileFolderSelection) self.btFileFolderSelection.onclick.connect( self.on_file_selection_bt_pressed) self.selectionDialog = gui.FileSelectionDialog('Select a file', '', False, './', True, False) self.selectionDialog.confirm_value.connect(self.file_dialog_confirmed)
def __init__(self, appInstance, **kwargs): super(UrlPathInput, self).__init__(**kwargs) self.appInstance = appInstance self.set_layout_orientation(gui.Widget.LAYOUT_HORIZONTAL) self.style['display'] = 'block' self.style['overflow'] = 'hidden' self.txtInput = gui.TextInput(True, width='80%', height='100%') self.txtInput.style['float'] = 'left' self.txtInput.set_on_change_listener(self, "on_txt_changed") self.append(self.txtInput) self.btFileFolderSelection = gui.Widget(width='20%', height='100%') self.btFileFolderSelection.style['background-repeat'] = 'round' self.btFileFolderSelection.style[ 'background-image'] = "url('/res/folder.png')" self.btFileFolderSelection.style['background-color'] = 'transparent' self.append(self.btFileFolderSelection) self.btFileFolderSelection.set_on_click_listener( self, 'on_file_selection_bt_pressed') self.selectionDialog = gui.FileSelectionDialog('Select a file', '', False, './', True, False) self.selectionDialog.set_on_confirm_value_listener( self, 'file_dialog_confirmed')
def menu_open_clicked(self, widget): self.fileselectionDialog = gui.FileSelectionDialog( 'File Selection Dialog', 'Select an image file', False, '.') self.fileselectionDialog.confirm_value.do(self.on_image_file_selected) self.fileselectionDialog.cancel_dialog.do(self.on_dialog_cancel) # here is shown the dialog as root widget self.fileselectionDialog.show(self)
def on_profile_copy_clicked(self): fileselectionDialog = gui.FileSelectionDialog( 'Copy Profile', 'Select a Profile to copy', False, self.top_dir) fileselectionDialog.set_on_confirm_value_listener( self, 'on_profile_copy_dialog_confirm') fileselectionDialog.set_on_cancel_dialog_listener( self, 'on_profile_copy_dialog_cancel') fileselectionDialog.show(self)
def menu_open_clicked(self): self.fileselectionDialog = gui.FileSelectionDialog( 600, 310, 'File Selection Dialog', 'Select an image file', False, '.') self.fileselectionDialog.set_on_confirm_value_listener( self, 'on_image_file_selected') # here is returned the Input Dialog widget, and it will be shown self.fileselectionDialog.show(self)
def open_existing_profile(self): initial_dir=self.pp_home_dir+os.sep+"pp_profiles"+self.pp_profiles_offset if os.path.exists(initial_dir) is False: OKDialog('Open Profile',"Profiles directory not found: " + initial_dir + "<br><br>Hint: Data Home option must end in pp_home").show(self) return open_existing_profile_dialog = gui.FileSelectionDialog('Open Profile','Select profile',False, initial_dir) #width=600,height=200, open_existing_profile_dialog.set_on_confirm_value_listener(self, 'open_existing_profile_dialog_confirm') open_existing_profile_dialog.show(self)
def open_fileselection_dialog(self, widget): self.fileselectionDialog = gui.FileSelectionDialog('File Selection Dialog', 'Select files and folders', False, '.') self.fileselectionDialog.confirm_value.do( self.on_fileselection_dialog_confirm) # here is returned the Input Dialog widget, and it will be shown self.fileselectionDialog.show(self)
def on_open_pressed(self, *_): self.fileselectionDialog = gui.FileSelectionDialog('File Selection Dialog', 'Select an image file', False, '.') self.fileselectionDialog.set_on_confirm_value_listener( self.process_image) self.fileselectionDialog.set_on_cancel_dialog_listener( self.on_dialog_cancel) # here is shown the dialog as root widget self.fileselectionDialog.show(self)
def open_fileselection_dialog(self): self.fileselectionDialog = gui.FileSelectionDialog('File Selection Dialog', 'Select files and folders', False, '.') self.fileselectionDialog.set_on_confirm_value_listener( self, 'on_fileselection_dialog_confirm') # here is returned the Input Dialog widget, and it will be shown self.fileselectionDialog.show(self)
def on_select_btn_pressed(self, widget): self.folder_selection_dialog = gui.FileSelectionDialog( 'Folder Selection Dialog', 'Select folder to generate m3u', False, '.', False) self.folder_selection_dialog.confirm_value.do( self.on_fileselection_dialog_confirm) # here is returned the Input Dialog widget, and it will be shown self.folder_selection_dialog.show(self)
def menu_open_clicked(self): self.fileselectionDialog = gui.FileSelectionDialog( 'File Selection Dialog', 'Select an image file', False, '.') self.fileselectionDialog.set_on_confirm_value_listener( self, 'on_image_file_selected') self.fileselectionDialog.set_on_cancel_dialog_listener( self, 'on_dialog_cancel') # here is shown the dialog as root widget self.fileselectionDialog.show(self)
def on_media_copy_clicked(self): fileselectionDialog = gui.FileSelectionDialog('Copy Media', 'Select files to copy', True, self.top_dir) fileselectionDialog.set_on_confirm_value_listener( self, 'on_media_copy_dialog_confirm') fileselectionDialog.set_on_cancel_dialog_listener( self, 'on_media_copy_dialog_cancel') fileselectionDialog.show(self)
def combine_files_with_network(self): ''' Select one or more Gellish files in a dialog and import the files, after syntactic verification. Then merge the file content in the semantic network. ''' self.read_file_container = gui.Widget(style={'width': '220px', 'display': 'block', 'overflow': 'auto', 'text-align': 'center'}) self.container.append(self.read_file_container) # Select one or more files to be imported self.dialog = gui.FileSelectionDialog('File selection dialog', 'Select one or more CSV or JSON files', False, '.', style='background-color:#eeffdd') self.dialog.confirm_value.connect(self.on_fileselection_dialog_confirm) self.dialog.cancel_dialog.connect(self.on_dialog_cancel) self.dialog.show(self)
def test_init(self): widget = gui.FileSelectionDialog() assertValidHTML(widget.repr())
def open_file_selection_dialog(self, event_emitter): """ TODO :param event_emitter: :return: """ selection_folder = None try: if event_emitter is self.model_file_button: print( 'Model file selection button was clicked to load trained {}.' .format(self._selected_model)) subfolders = ['dp_gp_lvm', 'bgplvm', 'mrd', 'fi_mrd', 'gplvm'] selection_folder = '../results/{}/'.format( subfolders[self.models.index(self._selected_model)]) except AttributeError: # Do nothing as that button has not been defined yet. pass try: if event_emitter is self.dataset_file_button: print( 'Data set file selection button was clicked to load {} data set.' .format(self._selected_dataset)) subfolders = [ None, None, 'cmu_mocap', None, None, 'skin_cancer_mnist', None, 'frey_faces' ] selection_folder = './data_io/data_sets/{}/'.format( subfolders[self.data_sets.index(self._selected_dataset)]) except AttributeError: # Do nothing as that button has not been defined yet. pass if selection_folder is not None: try: # Open file selection dialog at appropriate folder. file_selection_dialog = gui.FileSelectionDialog( title='File Selection', message='Select desired file.', multiple_selection=False, selection_folder=selection_folder, allow_file_selection=True, allow_folder_selection=False) # Reformat file selection dialog to make it look nicer. # file_selection_dialog.style['width'] = '700px' file_selection_keys = list( file_selection_dialog.children.keys()) file_selection_dialog.get_child( file_selection_keys[0]).set_style({ 'font-weight': '500', 'line-height': '1.1', 'color': UOB_BLUE, 'font-size': '28px', 'margin-top': '20px', 'text-shadow': 'none' }) file_selection_dialog.get_child( file_selection_keys[1]).set_style({ 'font-weight': '500', 'line-height': '1.1', 'color': UOB_GREY, 'font-size': '18px', 'margin-top': '10px', 'margin-bottom': '12px', 'text-shadow': 'none' }) file_selection_dialog.conf.set_text('OK') file_selection_dialog.conf.set_size(100, 35) file_selection_dialog.conf.add_class('btn btn-primary') file_selection_dialog.cancel.set_text('Cancel') file_selection_dialog.cancel.set_size(100, 35) file_selection_dialog.cancel.add_class('btn btn-primary') file_selection_dialog.fileFolderNavigator.controlsContainer.set_size( '100%', '50px') file_selection_dialog.fileFolderNavigator.controlBack.add_class( 'btn btn-primary') file_selection_dialog.fileFolderNavigator.controlGo.add_class( 'btn btn-primary') file_selection_dialog.fileFolderNavigator.controlGo.set_text( 'Go') # Disable text field and buttons to navigate folders; thereofre user is only allowed to choose files # in folder to which the dialog box opens. file_selection_dialog.fileFolderNavigator.pathEditor.attributes[ 'disabled'] = 'true' file_selection_dialog.fileFolderNavigator.controlBack.attributes[ 'disabled'] = 'true' file_selection_dialog.fileFolderNavigator.controlGo.attributes[ 'disabled'] = 'true' file_selection_dialog.confirm_value.connect( self.on_file_selection_dialog_confirm ) # Listener function. file_selection_dialog.show( self) # Show file selection dialog window. except FileNotFoundError as err: # Print error, but then do nothing as dialog window will not be shown. print("FileNotFoundError: {0}".format(err)) else: # Do nothing. So ignore that call. pass
def menu_template_clicked(self, widget): self.fileselectionDialog = gui.FileSelectionDialog( 'File Selection Dialog', 'Select files and folders', False, '.') self.fileselectionDialog.confirm_value.connect( self.on_template_fileselection_dialog_confirm) self.fileselectionDialog.show(self)
def menu_subject_clicked(self, widget): self.fileselectionDialog = gui.FileSelectionDialog( 'File Selection Dialog', "Select subject's map file", False, '.') self.fileselectionDialog.confirm_value.connect( self.on_subject_fileselection_dialog_confirm) self.fileselectionDialog.show(self)
def open_file_pressed(self): self.open_filedialog = gui.FileSelectionDialog(title='File Selection Dialog', message='Select a .CSV file', multiple_selection=False, allow_folder_selection=False) self.open_filedialog.set_on_confirm_value_listener(self, 'file_selection_confirm') self.open_filedialog.show(self)
def add_track_from_file(self): if self.current_medialist is None: return add_track_from_file_dialog = gui.FileSelectionDialog('Add Track', 'Select Tracks',True, self.eo.initial_media_dir)#600,200, add_track_from_file_dialog.set_on_confirm_value_listener(self, 'add_track_from_file_dialog_confirm') add_track_from_file_dialog.show(self)
def add_tracks_from_dir(self): if self.current_medialist is None: return add_tracks_from_dir_dialog = gui.FileSelectionDialog('Add Directory', 'Select Directory', multiple_selection = False, allow_file_selection=False, selection_folder = self.eo.initial_media_dir) add_tracks_from_dir_dialog.set_on_confirm_value_listener(self, 'add_tracks_from_dir_dialog_confirm') add_tracks_from_dir_dialog.show(self)
def menu_open_clicked(self, widget): self.fileselectionDialog = gui.FileSelectionDialog('File Selection Dialog', 'Select files and folders', True, '.') self.fileselectionDialog.confirm_value.connect(self.on_fileselection_dialog_confirm) # here is returned the Input Dialog widget, and it will be shown self.fileselectionDialog.show(self)
def cbk_select_pickle(self, widget): file_selector = gui.FileSelectionDialog("File Selection Dialog", "Select data pickle.", False, SURVEY_DIR) file_selector.set_on_confirm_value_listener(self.cbk_load) file_selector.show(self)