dash.contrib.plugins.image package

Submodules

dash.contrib.plugins.image.apps module

class dash.contrib.plugins.image.apps.Config(app_name, app_module)[source]

Bases: django.apps.config.AppConfig

label = 'dash.contrib.plugins.image'
name = 'dash.contrib.plugins.image'

dash.contrib.plugins.image.conf module

dash.contrib.plugins.image.conf.get_setting(setting, override=None)[source]

Get a setting from dash.contrib.plugins.image conf module, falling back to the default.

If override is not None, it will be used instead of the setting.

Parameters:
  • setting – String with setting name
  • override – Value to use when no setting is available. Defaults to None.
Returns:

Setting value.

dash.contrib.plugins.image.dash_plugins module

class dash.contrib.plugins.image.dash_plugins.BaseImagePlugin(layout_uid, placeholder_uid, workspace=None, user=None, position=None)[source]

Bases: dash.base.BaseDashboardPlugin

Base image plugin.

clone_plugin_data(dashboard_entry)[source]

Clone plugin data, which means we make a copy of the original image.

TODO: Perhaps rely more on data of dashboard_entry?

delete_plugin_data()[source]

Deletes uploaded file.

form

alias of ImageForm

group = <django.utils.functional.__proxy__ object at 0x7f10ff37ced0>
html_classes = ['pictonic']
name = <django.utils.functional.__proxy__ object at 0x7f10ff37ce90>

dash.contrib.plugins.image.dash_widgets module

class dash.contrib.plugins.image.dash_widgets.BaseImageWidget(plugin)[source]

Bases: dash.base.BaseDashboardPluginWidget

Base image plugin widget.

media_css = ('css/dash_plugin_image.css',)
media_js = ('js/dash_plugin_image.js',)
render(request=None)[source]
class dash.contrib.plugins.image.dash_widgets.Image1x1Widget(plugin)[source]

Bases: dash.contrib.plugins.image.dash_widgets.BaseImageWidget

Image1x1 plugin widget.

plugin_uid = 'image_1x1'
class dash.contrib.plugins.image.dash_widgets.Image1x2Widget(plugin)[source]

Bases: dash.contrib.plugins.image.dash_widgets.BaseImageWidget

Image1x2 plugin widget.

cols = 1
plugin_uid = 'image_1x2'
rows = 2
class dash.contrib.plugins.image.dash_widgets.Image2x1Widget(plugin)[source]

Bases: dash.contrib.plugins.image.dash_widgets.BaseImageWidget

Image2x1 plugin widget.

cols = 2
plugin_uid = 'image_2x1'
rows = 1
class dash.contrib.plugins.image.dash_widgets.Image2x2Widget(plugin)[source]

Bases: dash.contrib.plugins.image.dash_widgets.BaseImageWidget

Image2x2 plugin widget.

cols = 2
plugin_uid = 'image_2x2'
rows = 2
class dash.contrib.plugins.image.dash_widgets.Image2x3Widget(plugin)[source]

Bases: dash.contrib.plugins.image.dash_widgets.BaseImageWidget

Image2x3 plugin widget.

cols = 2
plugin_uid = 'image_2x3'
rows = 3
class dash.contrib.plugins.image.dash_widgets.Image3x2Widget(plugin)[source]

Bases: dash.contrib.plugins.image.dash_widgets.BaseImageWidget

Image3x2 plugin widget.

cols = 3
plugin_uid = 'image_3x2'
rows = 2
class dash.contrib.plugins.image.dash_widgets.Image3x3Widget(plugin)[source]

Bases: dash.contrib.plugins.image.dash_widgets.BaseImageWidget

Image3x3 plugin widget.

cols = 3
plugin_uid = 'image_3x3'
rows = 3
class dash.contrib.plugins.image.dash_widgets.Image3x4Widget(plugin)[source]

Bases: dash.contrib.plugins.image.dash_widgets.BaseImageWidget

Image3x4 plugin widget.

cols = 3
plugin_uid = 'image_3x4'
rows = 4
class dash.contrib.plugins.image.dash_widgets.Image4x4Widget(plugin)[source]

Bases: dash.contrib.plugins.image.dash_widgets.BaseImageWidget

Image4x4 plugin widget.

cols = 4
plugin_uid = 'image_4x4'
rows = 4
class dash.contrib.plugins.image.dash_widgets.Image4x5Widget(plugin)[source]

Bases: dash.contrib.plugins.image.dash_widgets.BaseImageWidget

Image4x5 plugin widget.

cols = 4
plugin_uid = 'image_4x5'
rows = 5
class dash.contrib.plugins.image.dash_widgets.Image5x4Widget(plugin)[source]

Bases: dash.contrib.plugins.image.dash_widgets.BaseImageWidget

Image5x4 plugin widget.

cols = 5
plugin_uid = 'image_5x4'
rows = 4
class dash.contrib.plugins.image.dash_widgets.Image5x5Widget(plugin)[source]

Bases: dash.contrib.plugins.image.dash_widgets.BaseImageWidget

Image5x5 plugin widget.

cols = 5
plugin_uid = 'image_5x5'
rows = 5

dash.contrib.plugins.image.defaults module

dash.contrib.plugins.image.forms module

class dash.contrib.plugins.image.forms.ImageForm(data=None, files=None, auto_id=u'id_%s', prefix=None, initial=None, error_class=<class 'django.forms.utils.ErrorList'>, label_suffix=None, empty_permitted=False)[source]

Bases: django.forms.forms.Form, dash.base.DashboardPluginFormBase

Image form for ImagePlugin plugin.

base_fields = OrderedDict([('title', <django.forms.fields.CharField object at 0x7f10ff37cbd0>), ('image', <django.forms.fields.ImageField object at 0x7f10ff37cc90>), ('fit_method', <django.forms.fields.ChoiceField object at 0x7f10ff37cd50>), ('show_link', <django.forms.fields.BooleanField object at 0x7f10ff37ce10>)])
declared_fields = OrderedDict([('title', <django.forms.fields.CharField object at 0x7f10ff37cbd0>), ('image', <django.forms.fields.ImageField object at 0x7f10ff37cc90>), ('fit_method', <django.forms.fields.ChoiceField object at 0x7f10ff37cd50>), ('show_link', <django.forms.fields.BooleanField object at 0x7f10ff37ce10>)])
media
plugin_data_fields = [('title', ''), ('image', ''), ('fit_method', 'center'), ('show_link', True)]
save_plugin_data(request=None)[source]

Saving the plugin data and moving the file.

dash.contrib.plugins.image.helpers module

dash.contrib.plugins.image.helpers.handle_uploaded_file(image_file)[source]
Parameters:image_file (django.core.files.uploadedfile.InMemoryUploadedFile) –
Return string:Path to the image (relative).
dash.contrib.plugins.image.helpers.get_crop_filter(fit_method)[source]
dash.contrib.plugins.image.helpers.delete_file(image_file)[source]

Delete file from disc.

dash.contrib.plugins.image.helpers.ensure_unique_filename(destination)[source]

Makes sure filenames are never overwritten. If file name already exists, makes a new one based on the first 50 chars of the original file name, having a uuid4 appended afterwards.

Parameters:destination (string) –
Return string:
dash.contrib.plugins.image.helpers.clone_file(source_filename, relative_path=True)[source]

Clones the file.

Parameters:source_filename (string) – Source filename.
Return string:Filename of the cloned file.

dash.contrib.plugins.image.settings module

  • FIT_METHOD_CROP_SMART (string)
  • FIT_METHOD_CROP_CENTER (string)
  • FIT_METHOD_CROP_SCALE (string)
  • FIT_METHOD_FIT_WIDTH (string)
  • FIT_METHOD_FIT_HEIGHT (string)
  • DEFAULT_FIT_METHOD (string)
  • FIT_METHODS_CHOICES (tuple)
  • FIT_METHODS_CHOICES_WITH_EMPTY_OPTION (list)
  • IMAGES_UPLOAD_DIR (string)

Module contents