pycrossword  0.3
Pure-Python implementation of a crossword puzzle generator and editor
Public Member Functions | Public Attributes | Private Member Functions | List of all members
pycross.forms.CustomPluginManager Class Reference

Custom plugin manager widget to add, delete, (de)activate and move around plugins. More...

Inheritance diagram for pycross.forms.CustomPluginManager:

Public Member Functions

def __init__ (self, mainwindow, parent=None)
 Constructor. More...
 
def addMainLayout (self)
 
def update_actions (self)
 Updates the Enabled property of each action based on the current selection in the plugin table. More...
 
def from_settings (self)
 Updates the plugin table (tree view) from the global settings. More...
 
def update_active_states (self)
 Sets the 'active' property of custom plugins in the global settings based on the state of the checkboxes in the plugin table. More...
 
def reload_plugins (self, forced_update=False)
 Re-creates the plugin manager instance (gui::MainWindow::plugin_mgr) and updates the plugins in the manager and the global settings. More...
 
def select_plugin (self, plcat, plname)
 Locates a plugin in the table by category and name and selects it. More...
 
def add_or_edit_plugin (self, plugin_item=None)
 Adds a new plugin or edits the given plugin. More...
 
def on_plugin_model_changed (self, QtGui.QStandardItem item)
 Fires when a plugin is checked or unchecked in the plugin table. More...
 
def on_tvPlugins_selected (self, selected, deselected)
 Fires when an item (plugin) is selected in the table. More...
 
def on_act_reload (self)
 The Reload action handler: reloads plugins from the plugin manager. More...
 
def on_act_add (self)
 The Add action handler: adds a new plugin. More...
 
def on_act_remove (self)
 The Delete action handler: deletes the selected plugins (>=1 plugins must be selected). More...
 
def on_act_edit (self)
 The Edit action handler: edits the selected plugin (only one must be selected). More...
 
def on_act_clear (self)
 The Clear action handler: clears (deletes) all plugins. More...
 
def on_act_up (self)
 The Up actions handler: moves the selected plugin upwards. More...
 
def on_act_down (self)
 The Down actions handler: moves the selected plugin downwards. More...
 

Public Attributes

 mainwindow
 
 lo_main
 
 tb_main
 
 act_reload
 
 act_add
 
 act_remove
 
 act_edit
 
 act_clear
 
 act_up
 
 act_down
 
 tvPlugins
 
 plugin_model
 

Private Member Functions

def _make_empty_item (self)
 Shortcut method to create a non-editable, disabled QStandardItem. More...
 
def _make_padded_row (self, item, empty_count)
 Shortcut method to create a row of QStandardItem elements where the first element is given by 'item' and the rest are dummy items created by CustomPluginManager::_make_empty_item(). More...
 

Detailed Description

Custom plugin manager widget to add, delete, (de)activate and move around plugins.

This is basically a tree-like table with a toolbar for manipulating plugins. Each plugin is a single row in the table. Parent nodes in the tree represent plugin categories.

Constructor & Destructor Documentation

◆ __init__()

def pycross.forms.CustomPluginManager.__init__ (   self,
  mainwindow,
  parent = None 
)

Constructor.

Parameters
mainwindowQtWidgets.QMainWindow pointer to gui::MainWindow instance
parentQtWidgets.QWidget parent widget (default = None, i.e. no parent)

Member Function Documentation

◆ _make_empty_item()

def pycross.forms.CustomPluginManager._make_empty_item (   self)
private

Shortcut method to create a non-editable, disabled QStandardItem.

◆ _make_padded_row()

def pycross.forms.CustomPluginManager._make_padded_row (   self,
  item,
  empty_count 
)
private

Shortcut method to create a row of QStandardItem elements where the first element is given by 'item' and the rest are dummy items created by CustomPluginManager::_make_empty_item().

Parameters
itemQtGui.QStandardItem first item in the row
empty_countint number of dummies that follow 'item'
Returns
list list of QtGui.QStandardItem elements

◆ add_or_edit_plugin()

def pycross.forms.CustomPluginManager.add_or_edit_plugin (   self,
  plugin_item = None 
)

Adds a new plugin or edits the given plugin.

Parameters
plugin_itemQtGui.QStandardItem the plugin item to edit; if None (default), a new plugin will be added

◆ addMainLayout()

def pycross.forms.CustomPluginManager.addMainLayout (   self)

◆ from_settings()

def pycross.forms.CustomPluginManager.from_settings (   self)

Updates the plugin table (tree view) from the global settings.

◆ on_act_add()

def pycross.forms.CustomPluginManager.on_act_add (   self)

The Add action handler: adds a new plugin.

See also
CustomPluginManager::add_or_edit_plugin()

◆ on_act_clear()

def pycross.forms.CustomPluginManager.on_act_clear (   self)

The Clear action handler: clears (deletes) all plugins.

Warning
This action will permanently delete the plugin files in 'plugins' directory!

◆ on_act_down()

def pycross.forms.CustomPluginManager.on_act_down (   self)

The Down actions handler: moves the selected plugin downwards.

This ultimately lowers the priority (precedence) of the plugin within the category since it will be handled after the other ones which come before it in the table.

◆ on_act_edit()

def pycross.forms.CustomPluginManager.on_act_edit (   self)

The Edit action handler: edits the selected plugin (only one must be selected).

◆ on_act_reload()

def pycross.forms.CustomPluginManager.on_act_reload (   self)

The Reload action handler: reloads plugins from the plugin manager.

See also
CustomPluginManager::reload_plugins()

◆ on_act_remove()

def pycross.forms.CustomPluginManager.on_act_remove (   self)

The Delete action handler: deletes the selected plugins (>=1 plugins must be selected).

Warning
This action will permanently delete the plugin files in 'plugins' directory!

◆ on_act_up()

def pycross.forms.CustomPluginManager.on_act_up (   self)

The Up actions handler: moves the selected plugin upwards.

This ultimately raises the priority (precedence) of the plugin within the category since it will be handled before the other ones which come after it in the table.

◆ on_plugin_model_changed()

def pycross.forms.CustomPluginManager.on_plugin_model_changed (   self,
QtGui.QStandardItem  item 
)

Fires when a plugin is checked or unchecked in the plugin table.

When checked, the corresponding plugin is enabled in the table, and vice-versa.

◆ on_tvPlugins_selected()

def pycross.forms.CustomPluginManager.on_tvPlugins_selected (   self,
  selected,
  deselected 
)

Fires when an item (plugin) is selected in the table.

◆ reload_plugins()

def pycross.forms.CustomPluginManager.reload_plugins (   self,
  forced_update = False 
)

Re-creates the plugin manager instance (gui::MainWindow::plugin_mgr) and updates the plugins in the manager and the global settings.

Parameters
forced_updatebool if True, all current plugin settings will be cleared and plugins will be added anew from the plugin folder (default = False)
See also
utils::pluginmanager::PxPluginManager::update_global_settings()

◆ select_plugin()

def pycross.forms.CustomPluginManager.select_plugin (   self,
  plcat,
  plname 
)

Locates a plugin in the table by category and name and selects it.

Parameters
plcatstr plugin category name
plnamestr plugin name
Returns
QtGui.QStandardItem found and selected plugin item or None on failure to locate

◆ update_actions()

def pycross.forms.CustomPluginManager.update_actions (   self)

Updates the Enabled property of each action based on the current selection in the plugin table.

◆ update_active_states()

def pycross.forms.CustomPluginManager.update_active_states (   self)

Sets the 'active' property of custom plugins in the global settings based on the state of the checkboxes in the plugin table.

Member Data Documentation

◆ act_add

pycross.forms.CustomPluginManager.act_add

◆ act_clear

pycross.forms.CustomPluginManager.act_clear

◆ act_down

pycross.forms.CustomPluginManager.act_down

◆ act_edit

pycross.forms.CustomPluginManager.act_edit

◆ act_reload

pycross.forms.CustomPluginManager.act_reload

◆ act_remove

pycross.forms.CustomPluginManager.act_remove

◆ act_up

pycross.forms.CustomPluginManager.act_up

◆ lo_main

pycross.forms.CustomPluginManager.lo_main

◆ mainwindow

pycross.forms.CustomPluginManager.mainwindow

◆ plugin_model

pycross.forms.CustomPluginManager.plugin_model

◆ tb_main

pycross.forms.CustomPluginManager.tb_main

◆ tvPlugins

pycross.forms.CustomPluginManager.tvPlugins

The documentation for this class was generated from the following file: