pyworkflow.gui.dialog module
Module to handling Dialogs some code was taken from tkSimpleDialog
- class pyworkflow.gui.dialog.Dialog(parent, title, lockGui=True, **kwargs)[source]
Bases:
Toplevel
Initialize a dialog. Arguments:
parent – a parent window (the application window) title – the dialog title
- **args accepts:
buttons – list of buttons tuples containing which buttons to display
- apply()[source]
process the data This method is called automatically to process the data, after the dialog is destroyed. By default, it does nothing.
- body(master)[source]
create dialog body. return widget that should have initial focus. This method should be overridden, and is called by the __init__ method.
- info(message)[source]
Shows a info message for long running processes to inform the user GUI is not frozen
- class pyworkflow.gui.dialog.EditObjectDialog(parent, title, obj, mapper, **kwargs)[source]
Bases:
Dialog
Dialog to edit some text
Initialize a dialog. Arguments:
parent – a parent window (the application window) title – the dialog title
- **args accepts:
buttons – list of buttons tuples containing which buttons to display
- apply()[source]
process the data This method is called automatically to process the data, after the dialog is destroyed. By default, it does nothing.
- class pyworkflow.gui.dialog.EntryDialog(parent, title, entryLabel, entryWidth=20, defaultValue='', headerLabel=None)[source]
Bases:
Dialog
Dialog to ask some entry
Initialize a dialog. Arguments:
parent – a parent window (the application window) title – the dialog title
- **args accepts:
buttons – list of buttons tuples containing which buttons to display
- apply()[source]
process the data This method is called automatically to process the data, after the dialog is destroyed. By default, it does nothing.
- class pyworkflow.gui.dialog.ExceptionDialog(*args, **kwargs)[source]
Bases:
MessageDialog
Initialize a dialog. Arguments:
parent – a parent window (the application window) title – the dialog title
- **args accepts:
buttons – list of buttons tuples containing which buttons to display
- class pyworkflow.gui.dialog.FlashMessage(master, msg, delay=5, relief='solid', func=None)[source]
Bases:
object
- class pyworkflow.gui.dialog.FloatingMessage(master, msg, xPos=None, yPos=None, textWidth=280, font='Helvetica', size=12, bd=1, bg='Firebrick', fg='white')[source]
Bases:
object
- class pyworkflow.gui.dialog.GenericDialog(master, title, msg, iconPath, **kwargs)[source]
Bases:
Dialog
Create a dialog with many buttons Arguments:
parent – a parent window (the application window) title – the dialog title msg – message to display into the dialog iconPath – path of the image to show into the dialog
- **args accepts:
buttons – list of buttons tuples containing which buttons to display and theirs values icons – list of icons for all buttons default – button default
- Example:
- buttons=[(‘Single’, RESULT_RUN_SINGLE),
(‘All’, RESULT_RUN_ALL), (‘Cancel’, RESULT_CANCEL)],
default=’Cancel’, icons={RESULT_CANCEL: Icon.BUTTON_CANCEL,
RESULT_RUN_SINGLE: Icon.BUTTON_SELECT, RESULT_RUN_ALL: Icon.ACTION_EXECUTE})
Initialize a dialog. Arguments:
parent – a parent window (the application window) title – the dialog title
- **args accepts:
buttons – list of buttons tuples containing which buttons to display
- class pyworkflow.gui.dialog.ListDialog(parent, title, provider, message=None, **kwargs)[source]
Bases:
Dialog
Dialog to select an element from a list. It is implemented using the Tree widget.
From kwargs:
- Parameters
message – message tooltip to show when browsing.
validateSelectionCallback – a callback function to validate selected items.
previewCallback – method to be called on item click to fill the callback frame.
selectmode – ‘extended’ by default. Selection mode of the tk.Tree
selectOnDoubleClick – (False). If True, double click will trigger “Select” button click
allowsEmptySelection – (False). Allows empty selection
allowSelect – if set to False, the ‘Select’ button will not be shown.
allowsEmptySelection – if set to True, it will not validate that at least one element was selected.
- apply()[source]
process the data This method is called automatically to process the data, after the dialog is destroyed. By default, it does nothing.
- class pyworkflow.gui.dialog.MessageDialog(parent, title, msg, iconPath, **args)[source]
Bases:
Dialog
Dialog subclasses to show message info, questions or errors. It can display an icon with the message
Initialize a dialog. Arguments:
parent – a parent window (the application window) title – the dialog title
- **args accepts:
buttons – list of buttons tuples containing which buttons to display
- class pyworkflow.gui.dialog.SearchBaseWindow(parentWindow, title='Search element', onClick=None, onDoubleClick=None, **kwargs)[source]
Bases:
Window
Base window for searching in a list You are going to implement several elements:
- columnsConfig: a dictionary with elements with this structure:
<column-key>: (<title>,{kwargs for tree.column method}, weight, <casting_method>(optional, otherwise str))
Example:
- columnConfig = {
‘#0’: (‘Status’, {‘width’: 50, ‘minwidth’: 50, ‘stretch’: tk.NO}, 3), ‘protocol’: (‘Protocol’, {‘width’: 300, ‘stretch’: tk.FALSE}), 5, ‘streaming’: (‘Streamified’, {‘width’: 100, ‘stretch’: tk.FALSE}, 3), ‘installed’: (‘Installation’, {‘width’: 110, ‘stretch’: tk.FALSE}, 3), ‘help’: (‘Help’, {‘minwidth’: 300, ‘stretch’: tk.YES}, 3), ‘score’: (‘Score’, {‘width’: 50, ‘stretch’: tk.FALSE}, 3, int),
}
_createResultsTree method _onSearchClick method
See SearchProtocolWindow as an example
Create a Tk window. title: string to use as title for the windows. master: if not provided, the windows create will be the principal one weight: if true, the first col and row will be configured with weight=1 minsize: a minimum size for height and width icon: if not None, set the windows icon
- CASTING_INDEX = 3
- COLUMN_KWARGS_INDEX = 1
- COLUMN_TEXT_INDEX = 0
- WEIGHT_INDEX = 2
- columnConfig = {}
- class pyworkflow.gui.dialog.ToolbarButton(text, command, icon=None, tooltip=None, shortcut=None)[source]
Bases:
object
Store information about the buttons that will be added to the toolbar.
- class pyworkflow.gui.dialog.ToolbarListDialog(parent, title, provider, message=None, toolbarButtons=None, **kwargs)[source]
Bases:
ListDialog
This class extend from ListDialog to allow an extra toolbar to handle operations over the elements in the list (e.g. Edit, New, Delete).
From kwargs: message: message tooltip to show when browsing. selected: the item that should be selected. validateSelectionCallback:
a callback function to validate selected items.
- allowSelect: if set to False, the ‘Select’ button will not
be shown.
- class pyworkflow.gui.dialog.YesNoDialog(master, title, msg, **kwargs)[source]
Bases:
MessageDialog
Ask a question with YES/NO answer
Initialize a dialog. Arguments:
parent – a parent window (the application window) title – the dialog title
- **args accepts:
buttons – list of buttons tuples containing which buttons to display
- pyworkflow.gui.dialog.askPath(title=None, msg='Select a file of a folder', path='.', onlyFolders=False, master=None, returnBaseName=False)[source]
- pyworkflow.gui.dialog.askString(title, label, parent, entryWidth=20, defaultValue='', headerLabel=None)[source]