Toolbar customizer widget (incorporated by SettingsDialog).
More...
|
def | _lw_add (self, lw, item, row=-1) |
| Util function: adds a new item to a QListWidget control. More...
|
|
Toolbar customizer widget (incorporated by SettingsDialog).
This widget provides the user with a handy tool to tweak a toolbar (in this app only the main toolbar is customizable) by adding / removing buttons / separators and changing their order.
- Todo:
- implement Drag And Drop from treeview to list / toolbar – see example
◆ __init__()
def pycross.forms.ToolbarCustomizer.__init__ |
( |
|
self, |
|
|
|
action_source, |
|
|
|
toolbar, |
|
|
|
parent = None |
|
) |
| |
Constructor.
- Parameters
-
action_source | QtWidgets.QActionGroup | QtWidgets.QMenu | QtWidgets.QAction source for actions added as toolbar buttons – either an action group or a menu, or a single action |
toolbar | QtWidgets.QToolBar the initial (source) toolbar that must be configured (each of which may have child actions) |
parent | QtWidgets.QWidget parent widget |
◆ _lw_add()
def pycross.forms.ToolbarCustomizer._lw_add |
( |
|
self, |
|
|
|
lw, |
|
|
|
item, |
|
|
|
row = -1 |
|
) |
| |
|
private |
Util function: adds a new item to a QListWidget control.
◆ add_src_action()
def pycross.forms.ToolbarCustomizer.add_src_action |
( |
|
self, |
|
|
|
action, |
|
|
|
tree_item = None |
|
) |
| |
Adds a source action to the left-hand treeview.
- Parameters
-
action | QtWidgets.QActionGroup | QtWidgets.QMenu | QtWidgets.QAction source for actions added as toolbar buttons – either an action group or a menu, or a single action (each of which may have child actions) |
tree_item | QtWidgets.QTreeWidgetItem | None tree widget item to add the action(s) to: if None , actions will be added as root nodes, otherwise they will be the children of 'tree_item' |
- Returns
QtWidgets.QTreeWidgetItem
the added tree widget item
◆ addMainLayout()
def pycross.forms.ToolbarCustomizer.addMainLayout |
( |
|
self | ) |
|
Creates the main layout for controls.
◆ from_list()
def pycross.forms.ToolbarCustomizer.from_list |
( |
|
self, |
|
|
|
act_list |
|
) |
| |
Initializes added actions from a list of action names as in CWSettings['gui']['toolbar_actions'].
- Parameters
-
act_list | iterable collection (e.g. list) of actions and 'SEP' (separators) |
- See also
- ToolbarCustomizer::to_list()
◆ on_act_add()
def pycross.forms.ToolbarCustomizer.on_act_add |
( |
|
self | ) |
|
Adds selected action(s) to the target list.
◆ on_act_addsep()
def pycross.forms.ToolbarCustomizer.on_act_addsep |
( |
|
self | ) |
|
Adds a separator after the selected action.
◆ on_act_clear()
def pycross.forms.ToolbarCustomizer.on_act_clear |
( |
|
self | ) |
|
Clears all added actions.
◆ on_act_down()
def pycross.forms.ToolbarCustomizer.on_act_down |
( |
|
self | ) |
|
Moves selected action down.
◆ on_act_remove()
def pycross.forms.ToolbarCustomizer.on_act_remove |
( |
|
self | ) |
|
Removes the selected action from the target list.
◆ on_act_up()
def pycross.forms.ToolbarCustomizer.on_act_up |
( |
|
self | ) |
|
Moves selected action up.
◆ on_tw_actions_selected()
def pycross.forms.ToolbarCustomizer.on_tw_actions_selected |
( |
|
self | ) |
|
Updates available actions when the selection changes.
◆ reset()
def pycross.forms.ToolbarCustomizer.reset |
( |
|
self | ) |
|
Resets (reloads) source and target actions from the source toolbar.
◆ to_list()
def pycross.forms.ToolbarCustomizer.to_list |
( |
|
self | ) |
|
Serializes the added actions into a flat list of actions and 'SEP' (separators).
- Returns
list
list of actions and 'SEP' (separators)
- See also
- ToolbarCustomizer::from_list()
◆ update_actions()
def pycross.forms.ToolbarCustomizer.update_actions |
( |
|
self | ) |
|
Enables or disables actions depending on the selection of source and target buttons.
◆ update_added()
def pycross.forms.ToolbarCustomizer.update_added |
( |
|
self, |
|
|
|
actions, |
|
|
|
clear = True |
|
) |
| |
Reloads the right-hand actions (list view) from an action source.
- Parameters
-
actions | iterable collection of source actions (each of type QtWidgets.QAction ) |
clear | bool whether to clear the existing items (actions) before adding new ones |
◆ update_src_actions()
def pycross.forms.ToolbarCustomizer.update_src_actions |
( |
|
self | ) |
|
Disables elements in the source action treeview which are already added to the target list view.
◆ act_add
pycross.forms.ToolbarCustomizer.act_add |
◆ act_addsep
pycross.forms.ToolbarCustomizer.act_addsep |
◆ act_clear
pycross.forms.ToolbarCustomizer.act_clear |
◆ act_down
pycross.forms.ToolbarCustomizer.act_down |
◆ act_remove
pycross.forms.ToolbarCustomizer.act_remove |
◆ act_up
pycross.forms.ToolbarCustomizer.act_up |
◆ action_source
pycross.forms.ToolbarCustomizer.action_source |
QtWidgets.QActionGroup
| QtWidgets.QMenu
| QtWidgets.QAction
source for actions The source actions will be shown on the left-hand panel (ToolbarCustomizer::tw_actions)
◆ l_added
pycross.forms.ToolbarCustomizer.l_added |
◆ layout_controls
pycross.forms.ToolbarCustomizer.layout_controls |
◆ layout_preview
pycross.forms.ToolbarCustomizer.layout_preview |
◆ layout_right
pycross.forms.ToolbarCustomizer.layout_right |
◆ lw_added
pycross.forms.ToolbarCustomizer.lw_added |
QtWidgets.QListWidget
target actions (buttons) and separators to be shown in the toolbar
◆ splitter1
pycross.forms.ToolbarCustomizer.splitter1 |
◆ src_actions
pycross.forms.ToolbarCustomizer.src_actions |
◆ src_toolbar
pycross.forms.ToolbarCustomizer.src_toolbar |
QtWidgets.QToolBar
the initial (source) toolbar that must be configured All buttons (actions) already present in the toolbar will be shown on the right-hand panel (ToolbarCustomizer::lw_added)
◆ tb
pycross.forms.ToolbarCustomizer.tb |
◆ tw_actions
pycross.forms.ToolbarCustomizer.tw_actions |
QtWidgets.QTreeWidget
source actions (buttons) that can be added to the toolbar
◆ w_layout_right
pycross.forms.ToolbarCustomizer.w_layout_right |
The documentation for this class was generated from the following file: