class documentation

class FileDialog(Dialog): (source)

Known subclasses: zim.gui.pageview.AttachFileDialog, zim.gui.pageview.InsertImageDialog, zim.gui.pageview.InsertTextFromFileDialog, zim.gui.uiactions.ImportPageDialog, zim.gui.uiactions.SaveCopyDialog

View In Hierarchy

File Chooser dialog, that allows to browser the file system and select files or folders. Similar to Gtk.FileChooserDialog but inherits from Dialog instead.

This dialog will automatically show previews for image files.

When using dialog.run() it will return the selected file(s) or dir(s) based on the arguments given during construction.

Method __init__ Constructor.
Method add_filter No summary
Method add_filter_images Add a standard file filter for selecting image files. @returns: the Gtk.FileFilter object
Method add_shortcut Add shortcuts for the notebook folder and page folder
Method do_response_ok No summary
Method get_dir No summary
Method get_file Get the current selected file @returns: a LocalFile object or None.
Method get_files Get list of selected file. Assumes the dialog was created with multiple=True. @returns: a list of LocalFile objects
Method load_last_folder Undocumented
Method on_update_preview Undocumented
Method save_last_folder Undocumented
Method set_current_dir Set the current folder for the dialog (Only needed if not followed by set_file()) @param dir: a Folder object
Method set_file Set the file or dir to pre select in the dialog @param file: a File or Folder object
Instance Variable filechooser Undocumented
Instance Variable preview_widget Undocumented
Instance Variable result Undocumented
Method _add_filter_all Undocumented
Instance Variable _action Undocumented
Instance Variable _file Undocumented

Inherited from Dialog:

Class Method unique No summary
Method add_extra_button No summary
Method add_form Convenience method to construct a form with input widgets and add them to the dialog. See InputForm.add_inputs() for details.
Method add_help_text Adds a label with an info icon in front of it. Intended for informational text in dialogs. @param text: help text
Method add_text Adds a label to the dialog Also see add_help_text() for another style option. @param text: dialog text
Method assert_response_ok No summary
Method do_response Undocumented
Method do_response_cancel Handler called when the user clicks the "Cancel" button.
Method get_input Method used in test suite to get "interactive" inputs
Method get_input_enabled Undocumented
Method on_destroy Undocumented
Method present Undocumented
Method response_ok Trigger the response signal with response type 'OK'.
Method run Wrapper for Gtk.Dialog.run(), also calls show_all() @returns: self.result
Method save_uistate Method when the dialog is about to exit or hide and wants to save the uistate. Sub-classes implementing this method should use it to set additional state parameter in self.uistate.
Method set_help Set the name of the manual page with help for this dialog. Setting this will add a "help" button to the dialog. @param pagename: the manual page name
Method set_input No summary
Method show Undocumented
Method show_all Undocumented
Method show_help Show a help page @param page: the manual page, if None the page as set with set_help() is used
Instance Variable destroyed when True the dialog is already destroyed
Instance Variable form InputForm added by add_form()
Instance Variable help_page Undocumented
Instance Variable uistate ConfigDict to store state of the dialog, persistent per notebook. The size and position of the dialog are stored as automatically in this dict already.
Instance Variable vbox Gtk.VBox for main widgets of the dialog
Instance Variable _no_ok_action Undocumented

Inherited from ConnectorMixin (via Dialog):

Method connectto Connect to signals of another object E.g.:
Method connectto_all Convenience method to combine multiple calls to connectto().
Method disconnect_all Disconnect all signals that have been connected with connectto and friends. Typically called when you want to destroy this object.
Method disconnect_from Disc all signals that have been connected with connectto and friends to a specific object.
Method _disconnect_from Undocumented
Instance Variable _connected_signals Undocumented
def __init__(self, parent, title, action=Gtk.FileChooserAction.OPEN, buttons=Gtk.ButtonsType.OK_CANCEL, button=None, help_text=None, help=None, multiple=False): (source)
Constructor.
Parameters
parenteither a parent window or dialog or None
titlethe dialog title
action

the file chooser action, one of:

        Gtk.FileChooserAction.OPEN
        Gtk.FileChooserAction.SAVE
        Gtk.FileChooserAction.SELECT_FOLDER
        Gtk.FileChooserAction.CREATE_FOLDER
buttonssee Dialog.__init__()
buttonsee Dialog.__init__()
help_textsee Dialog.__init__()
helpsee Dialog.__init__()
multipleif True the dialog will allow selecting multiple files at once.
def add_filter(self, name, glob): (source)
Add a filter for files with specific extensions in the dialog
Parameters
namethe label to display in the filter selection
globa file pattern (e.g. "*.txt")
Returns
the Gtk.FileFilter object
def add_filter_images(self): (source)
Add a standard file filter for selecting image files.
Returns
the Gtk.FileFilter object
def add_shortcut(self, notebook, path=None): (source)
Add shortcuts for the notebook folder and page folder
def do_response_ok(self): (source)
Default response handler. Will check filechooser action and whether or not we select multiple files or dirs and set result of the dialog accordingly, so the method run() will return the selected file(s) or folder(s).
def get_dir(self): (source)
Get the the current selected dir. Assumes the dialog was created with action Gtk.FileChooserAction.SELECT_FOLDER or Gtk.FileChooserAction.CREATE_FOLDER.
Returns
a LocalFolder object or None
def get_file(self): (source)
Get the current selected file
Returns
a LocalFile object or None.
def get_files(self): (source)
Get list of selected file. Assumes the dialog was created with multiple=True.
Returns
a list of LocalFile objects
def load_last_folder(self): (source)

Undocumented

def on_update_preview(self, *a): (source)

Undocumented

def save_last_folder(self): (source)

Undocumented

def set_current_dir(self, dir): (source)
Set the current folder for the dialog (Only needed if not followed by set_file())
Parameters
dira Folder object
def set_file(self, file): (source)
Set the file or dir to pre select in the dialog
Parameters
filea File or Folder object
filechooser = (source)

Undocumented

preview_widget = (source)

Undocumented

def _add_filter_all(self): (source)

Undocumented

_action = (source)

Undocumented

_file = (source)

Undocumented