Repository: trombastic/PyScada
Branch: main
Commit: c75dbbcdf133
Files: 462
Total size: 3.1 MB
Directory structure:
gitextract_2o9djmi1/
├── .flake8
├── .gitignore
├── .pre-commit-config.yaml
├── .readthedocs.yaml
├── AUTHORS
├── CHANGELOG.txt
├── LICENSE
├── MANIFEST.in
├── README.rst
├── docker/
│ ├── docker-compose.yml-tmp
│ ├── mysql/
│ │ └── Dockerfile-tmp
│ ├── nginx/
│ │ ├── Dockerfile
│ │ └── nginx.conf
│ └── pyscada/
│ ├── Dockerfile
│ ├── pyscada
│ └── pyscada_init
├── docs/
│ ├── Makefile
│ ├── backend.rst
│ ├── command-line.rst
│ ├── conf.py
│ ├── control_item.rst
│ ├── develop.rst
│ ├── device_protocol.rst
│ ├── django_settings.rst
│ ├── docker.rst
│ ├── frontend.rst
│ ├── grafana.rst
│ ├── index.rst
│ ├── installation.rst
│ ├── make.bat
│ ├── nginx_setup.rst
│ ├── phant.rst
│ ├── plugin_install.rst
│ ├── quick_install.rst
│ ├── raspberryPiOS.rst
│ ├── uninstall.rst
│ ├── update.rst
│ └── visa.rst
├── eslint.config.mjs
├── extras/
│ ├── 0.7to0.8.sh
│ ├── Grafana-test-dashboard.json
│ ├── nginx_sample.conf
│ ├── pyscada-logrotate
│ ├── service/
│ │ ├── SysV-init/
│ │ │ ├── gunicorn_django
│ │ │ └── pyscada_daemon
│ │ ├── systemd/
│ │ │ ├── gunicorn.service
│ │ │ ├── gunicorn.socket
│ │ │ ├── owfs.service
│ │ │ └── pyscada_daemon.service
│ │ └── windows/
│ │ └── register_windows_service.py
│ ├── settings.py
│ └── urls.py
├── install.sh
├── install_docker.sh
├── install_venv.sh
├── move_data.py
├── pyproject.toml
├── pyscada/
│ ├── __init__.py
│ ├── admin.py
│ ├── apps.py
│ ├── cache_datasource/
│ │ ├── __init__.py
│ │ ├── apps.py
│ │ ├── migrations/
│ │ │ ├── 0001_initial.py
│ │ │ └── __init__.py
│ │ └── models.py
│ ├── core/
│ │ ├── __init__.py
│ │ └── urls.py
│ ├── device.py
│ ├── django_datasource/
│ │ ├── __init__.py
│ │ ├── apps.py
│ │ ├── migrations/
│ │ │ ├── 0001_initial.py
│ │ │ └── __init__.py
│ │ └── models.py
│ ├── event/
│ │ ├── __init__.py
│ │ └── worker.py
│ ├── export/
│ │ ├── __init__.py
│ │ ├── admin.py
│ │ ├── apps.py
│ │ ├── csv_file.py
│ │ ├── export.py
│ │ ├── hdf5_file.py
│ │ ├── management/
│ │ │ ├── __init__.py
│ │ │ └── commands/
│ │ │ ├── PyScadaExportData.py
│ │ │ └── __init__.py
│ │ ├── migrations/
│ │ │ ├── 0001_initial.py
│ │ │ ├── 0002_auto_20151201_1617.py
│ │ │ ├── 0003_auto_20160315_1140.py
│ │ │ ├── 0004_exporttask.py
│ │ │ ├── 0005_auto_20160403_1454.py
│ │ │ ├── 0006_auto_20160404_0949.py
│ │ │ ├── 0007_auto_20161124_1002.py
│ │ │ ├── 0008_auto_20161124_1003.py
│ │ │ ├── 0009_auto_20161128_0948.py
│ │ │ ├── 0010_auto_20161128_1049.py
│ │ │ ├── 0011_exporttask_filename.py
│ │ │ ├── 0012_exporttask_backgroundprocess.py
│ │ │ ├── 0013_auto_20170711_0729.py
│ │ │ ├── 0014_auto_20170711_1326.py
│ │ │ ├── 0015_remove_exporttask_backgroundtask.py
│ │ │ ├── 0016_auto_20191004_0912.py
│ │ │ └── __init__.py
│ │ ├── models.py
│ │ └── worker.py
│ ├── fixtures/
│ │ ├── color.json
│ │ └── units.json
│ ├── generic/
│ │ ├── __init__.py
│ │ ├── device.py
│ │ ├── devices/
│ │ │ ├── __init__.py
│ │ │ ├── dummy.py
│ │ │ └── waveform.py
│ │ └── worker.py
│ ├── hmi/
│ │ ├── __init__.py
│ │ ├── admin.py
│ │ ├── apps.py
│ │ ├── migrations/
│ │ │ ├── 0001_initial.py
│ │ │ ├── 0002_auto_20151016_1932.py
│ │ │ ├── 0003_auto_20151130_1456.py
│ │ │ ├── 0004_auto_20151130_1502.py
│ │ │ ├── 0005_auto_20160111_1822.py
│ │ │ ├── 0006_auto_20160111_1848.py
│ │ │ ├── 0007_auto_20160518_0848.py
│ │ │ ├── 0008_auto_20180620_0716.py
│ │ │ ├── 0009_controlitem_property_name.py
│ │ │ ├── 0010_auto_20180705_1341.py
│ │ │ ├── 0011_auto_20180710_1549.py
│ │ │ ├── 0012_auto_20180912_1302.py
│ │ │ ├── 0013_widget_update_20180912_1315.py
│ │ │ ├── 0014_auto_20180912_1340.py
│ │ │ ├── 0015_auto_20180913_1608.py
│ │ │ ├── 0016_auto_20181004_0831.py
│ │ │ ├── 0017_groupdisplaypermission_forms.py
│ │ │ ├── 0018_auto_20181205_0937.py
│ │ │ ├── 0019_auto_20181205_1058.py
│ │ │ ├── 0020_pie.py
│ │ │ ├── 0021_auto_20190528_0924.py
│ │ │ ├── 0022_auto_20191004_0912.py
│ │ │ ├── 0023_dropdownitem_value.py
│ │ │ ├── 0024_auto_20191212_1516.py
│ │ │ ├── 0025_widgetcontent_content_str.py
│ │ │ ├── 0026_auto_20200915_1333.py
│ │ │ ├── 0027_auto_20200915_1407.py
│ │ │ ├── 0028_auto_20200915_1540.py
│ │ │ ├── 0029_auto_20200916_0720.py
│ │ │ ├── 0030_auto_20200918_0842.py
│ │ │ ├── 0031_auto_20200918_1206.py
│ │ │ ├── 0032_auto_20200918_1408.py
│ │ │ ├── 0033_auto_20200918_1439.py
│ │ │ ├── 0034_auto_20200918_1445.py
│ │ │ ├── 0035_auto_20200918_1517.py
│ │ │ ├── 0036_auto_20200923_0850.py
│ │ │ ├── 0037_auto_20200923_0852.py
│ │ │ ├── 0038_auto_20200929_1410.py
│ │ │ ├── 0039_auto_20201002_0928.py
│ │ │ ├── 0040_dictionary_dictionaryitem.py
│ │ │ ├── 0041_auto_20201002_0934.py
│ │ │ ├── 0042_auto_20201201_1335.py
│ │ │ ├── 0043_auto_20201201_1411.py
│ │ │ ├── 0044_auto_20201201_1539.py
│ │ │ ├── 0045_auto_20201201_2100.py
│ │ │ ├── 0046_auto_20201201_2109.py
│ │ │ ├── 0047_auto_20201202_1445.py
│ │ │ ├── 0048_chartaxis_fill.py
│ │ │ ├── 0049_auto_20201202_2037.py
│ │ │ ├── 0050_auto_20201203_2101.py
│ │ │ ├── 0051_auto_20201204_0901.py
│ │ │ ├── 0052_auto_20201204_0949.py
│ │ │ ├── 0053_auto_20211118_1438.py
│ │ │ ├── 0054_displayvalueoption_type.py
│ │ │ ├── 0055_auto_20211125_1405.py
│ │ │ ├── 0056_auto_20211210_1608.py
│ │ │ ├── 0057_auto_20211214_1157.py
│ │ │ ├── 0058_auto_20220523_1639.py
│ │ │ ├── 0059_alter_view_theme.py
│ │ │ ├── 0060_chartaxis_show_bars.py
│ │ │ ├── 0061_auto_20220610_1459.py
│ │ │ ├── 0062_auto_20220616_1523.py
│ │ │ ├── 0063_move_group_display_permissions.py
│ │ │ ├── 0064_auto_20220617_1333.py
│ │ │ ├── 0065_auto_20220620_0854.py
│ │ │ ├── 0066_auto_20221205_1435.py
│ │ │ ├── 0067_alter_cssclass_options.py
│ │ │ ├── 0068_alter_displayvalueoption_timestamp_conversion.py
│ │ │ ├── 0069_displayvalueoption_color_and_more.py
│ │ │ ├── 0070_move_displayvalueoptions.py
│ │ │ ├── 0071_remove_displayvalueoption_color_1_and_more.py
│ │ │ ├── 0072_alter_groupdisplaypermission_hmi_group.py
│ │ │ ├── 0073_alter_processflowdiagramitem_control_item.py
│ │ │ ├── 0074_alter_cssclass_css_class.py
│ │ │ ├── 0075_alter_processflowdiagram_url_height_and_more.py
│ │ │ ├── 0076_displayvalueoptiontemplate_transformdata_and_more.py
│ │ │ ├── 0077_transformdatacountvalue.py
│ │ │ ├── 0078_alter_theme_base_filename_alter_theme_view_filename.py
│ │ │ ├── 0079_displayvalueoption_from_timestamp_offset.py
│ │ │ ├── 0080_view_default_time_delta.py
│ │ │ ├── 0081_groupdisplaypermission_unauthenticated_users.py
│ │ │ ├── 0082_externalview.py
│ │ │ ├── 0083_externalviewgroupdisplaypermission.py
│ │ │ └── __init__.py
│ │ ├── models.py
│ │ ├── signals.py
│ │ ├── static/
│ │ │ └── pyscada/
│ │ │ ├── css/
│ │ │ │ ├── bootstrap/
│ │ │ │ │ ├── bootstrap-theme.css
│ │ │ │ │ └── bootstrap.css
│ │ │ │ ├── daterangepicker/
│ │ │ │ │ └── daterangepicker.css
│ │ │ │ ├── fonts/
│ │ │ │ │ └── roboto/
│ │ │ │ │ └── LICENSE.txt
│ │ │ │ ├── jquery-ui/
│ │ │ │ │ ├── AUTHORS.txt
│ │ │ │ │ ├── LICENSE.txt
│ │ │ │ │ ├── jquery-ui.css
│ │ │ │ │ ├── jquery-ui.structure.css
│ │ │ │ │ ├── jquery-ui.theme.css
│ │ │ │ │ └── package.json
│ │ │ │ └── pyscada/
│ │ │ │ └── pyscada-theme.css
│ │ │ └── js/
│ │ │ ├── MIT-LICENSE.txt
│ │ │ ├── admin/
│ │ │ │ ├── display_inline_datasource.js
│ │ │ │ ├── display_inline_protocols_device.js
│ │ │ │ ├── display_inline_protocols_variable.js
│ │ │ │ ├── display_inline_transform_data_display_value_option.js
│ │ │ │ ├── handler_content_as_pre.js
│ │ │ │ └── hideshow.js
│ │ │ ├── bootstrap/
│ │ │ │ ├── affix.js
│ │ │ │ ├── alert.js
│ │ │ │ ├── bootstrap.js
│ │ │ │ ├── button.js
│ │ │ │ ├── carousel.js
│ │ │ │ ├── collapse.js
│ │ │ │ ├── dropdown.js
│ │ │ │ ├── modal.js
│ │ │ │ ├── npm.js
│ │ │ │ ├── popover.js
│ │ │ │ ├── scrollspy.js
│ │ │ │ ├── tab.js
│ │ │ │ ├── tooltip.js
│ │ │ │ └── transition.js
│ │ │ ├── dexie/
│ │ │ │ └── LICENSE.txt
│ │ │ ├── flot/
│ │ │ │ ├── LICENSE.txt
│ │ │ │ ├── jquery.event.drag.LICENSE.txt
│ │ │ │ ├── jquery.mousewheel.LICENSE.txt
│ │ │ │ ├── lib/
│ │ │ │ │ ├── globalize.culture.en-US.js
│ │ │ │ │ ├── globalize.js
│ │ │ │ │ ├── jquery.event.drag.js
│ │ │ │ │ └── jquery.mousewheel.js
│ │ │ │ └── source/
│ │ │ │ ├── jquery.canvaswrapper.js
│ │ │ │ ├── jquery.colorhelpers.js
│ │ │ │ ├── jquery.flot.axislabels.js
│ │ │ │ ├── jquery.flot.browser.js
│ │ │ │ ├── jquery.flot.categories.js
│ │ │ │ ├── jquery.flot.composeImages.js
│ │ │ │ ├── jquery.flot.crosshair.js
│ │ │ │ ├── jquery.flot.drawSeries.js
│ │ │ │ ├── jquery.flot.errorbars.js
│ │ │ │ ├── jquery.flot.fillbetween.js
│ │ │ │ ├── jquery.flot.flatdata.js
│ │ │ │ ├── jquery.flot.gauge.js
│ │ │ │ ├── jquery.flot.hover.js
│ │ │ │ ├── jquery.flot.image.js
│ │ │ │ ├── jquery.flot.js
│ │ │ │ ├── jquery.flot.legend.js
│ │ │ │ ├── jquery.flot.logaxis.js
│ │ │ │ ├── jquery.flot.navigate.js
│ │ │ │ ├── jquery.flot.pie.js
│ │ │ │ ├── jquery.flot.resize.js
│ │ │ │ ├── jquery.flot.saturated.js
│ │ │ │ ├── jquery.flot.selection.js
│ │ │ │ ├── jquery.flot.stack.js
│ │ │ │ ├── jquery.flot.symbol.js
│ │ │ │ ├── jquery.flot.threshold.js
│ │ │ │ ├── jquery.flot.time.js
│ │ │ │ ├── jquery.flot.touch.js
│ │ │ │ ├── jquery.flot.touchNavigate.js
│ │ │ │ ├── jquery.flot.uiConstants.js
│ │ │ │ └── jquery.js
│ │ │ ├── jquery/
│ │ │ │ ├── jquery.cookie.js
│ │ │ │ └── parser-input-select.js
│ │ │ ├── jquery-ui/
│ │ │ │ ├── AUTHORS.txt
│ │ │ │ ├── LICENSE.txt
│ │ │ │ ├── jquery-ui.js
│ │ │ │ └── package.json
│ │ │ ├── jquery.flot.axisvalues.js
│ │ │ ├── pyscada/
│ │ │ │ ├── TransformDataHmiPlugin.js
│ │ │ │ ├── pyscada_tests.js
│ │ │ │ └── pyscada_v0-9-0.js
│ │ │ └── tempusdominus-bootstrap-3.js
│ │ ├── templates/
│ │ │ ├── 403.html
│ │ │ ├── _chart_legend.html
│ │ │ ├── base.html
│ │ │ ├── button.html
│ │ │ ├── chart.html
│ │ │ ├── chart_legend.html
│ │ │ ├── choose_login.html
│ │ │ ├── circular_gauge.html
│ │ │ ├── content_page.html
│ │ │ ├── control_element.html
│ │ │ ├── control_panel.html
│ │ │ ├── custom_html_panel.html
│ │ │ ├── dropdown.html
│ │ │ ├── form.html
│ │ │ ├── login.html
│ │ │ ├── modelProperties.html
│ │ │ ├── password_change.html
│ │ │ ├── password_change_done.html
│ │ │ ├── pie.html
│ │ │ ├── process_flow_diagram.html
│ │ │ ├── status_element.html
│ │ │ ├── svg_loading_icon.html
│ │ │ ├── template_not_found.html
│ │ │ ├── user_dropdown.html
│ │ │ ├── user_profile_change.html
│ │ │ ├── value_field.html
│ │ │ ├── view.html
│ │ │ ├── view_overview.html
│ │ │ └── widget_row.html
│ │ ├── templatetags/
│ │ │ ├── __init__.py
│ │ │ └── views_extras.py
│ │ ├── urls.py
│ │ └── views.py
│ ├── log/
│ │ └── __init__.py
│ ├── mail/
│ │ ├── __init__.py
│ │ └── worker.py
│ ├── management/
│ │ ├── __init__.py
│ │ └── commands/
│ │ ├── __init__.py
│ │ └── pyscada_daemon.py
│ ├── migrations/
│ │ ├── 0001_initial.py
│ │ ├── 0002_event_hysteresis.py
│ │ ├── 0003_auto_20151026_1826.py
│ │ ├── 0004_unit_udunit.py
│ │ ├── 0005_merge.py
│ │ ├── 0006_auto_20151130_1449.py
│ │ ├── 0007_auto_20151201_1613.py
│ │ ├── 0008_auto_20151201_1614.py
│ │ ├── 0009_auto_20160111_1802.py
│ │ ├── 0010_auto_20160115_0918.py
│ │ ├── 0011_auto_20160115_0920.py
│ │ ├── 0012_auto_20160119_0950.py
│ │ ├── 0013_auto_20160204_0840.py
│ │ ├── 0014_auto_20160210_1152.py
│ │ ├── 0015_auto_20160215_1522.py
│ │ ├── 0016_auto_20160215_2002.py
│ │ ├── 0017_recordeddata.py
│ │ ├── 0018_auto_20160228_1623.py
│ │ ├── 0019_datamigration_20160228_1624.py
│ │ ├── 0020_auto_20160228_1641.py
│ │ ├── 0021_auto_20160228_1643.py
│ │ ├── 0022_auto_20160228_2029.py
│ │ ├── 0023_auto_20160314_1817.py
│ │ ├── 0024_auto_20160517_1047.py
│ │ ├── 0025_auto_20160517_1734.py
│ │ ├── 0026_auto_20160518_0848.py
│ │ ├── 0027_auto_20160530_1436.py
│ │ ├── 0028_auto_20160630_0831.py
│ │ ├── 0029_scaling_limit_input.py
│ │ ├── 0030_device_polling_interval.py
│ │ ├── 0031_delete_variableconfigfileimport.py
│ │ ├── 0032_auto_20161107_2206.py
│ │ ├── 0033_auto_20161107_2241.py
│ │ ├── 0034_auto_20170213_0855.py
│ │ ├── 0035_auto_20170224_1215.py
│ │ ├── 0036_auto_20170224_1245.py
│ │ ├── 0037_auto_20170418_0931.py
│ │ ├── 0038_auto_20170707_1209.py
│ │ ├── 0039_auto_20170711_1326.py
│ │ ├── 0040_auto_20170905_0942.py
│ │ ├── 0041_update_protocol_id.py
│ │ ├── 0042_auto_20180604_1240.py
│ │ ├── 0043_devicewritetask_property_name.py
│ │ ├── 0044_auto_20180704_1307.py
│ │ ├── 0045_auto_20180705_1341.py
│ │ ├── 0046_remove_devicewritetask_property_name.py
│ │ ├── 0047_recordeddatanew.py
│ │ ├── 0047_variableproperty_unit.py
│ │ ├── 0048_datamigration_20181025_0918.py
│ │ ├── 0049_auto_20181025_1049.py
│ │ ├── 0050_merge_20181130_1143.py
│ │ ├── 0051_auto_20181206_1107.py
│ │ ├── 0052_auto_20181207_1019.py
│ │ ├── 0053_auto_20190207_1526.py
│ │ ├── 0053_auto_20190307_1423.py
│ │ ├── 0054_auto_20190208_0913.py
│ │ ├── 0054_auto_20190411_0749.py
│ │ ├── 0055_auto_20190625_1752.py
│ │ ├── 0056_auto_20190625_1823.py
│ │ ├── 0057_auto_20191004_0912.py
│ │ ├── 0058_merge_20191206_1328.py
│ │ ├── 0059_auto_20200211_1049.py
│ │ ├── 0060_auto_20200914_1417.py
│ │ ├── 0061_devicereadtask.py
│ │ ├── 0062_auto_20201002_0830.py
│ │ ├── 0063_complexevent_complexeventitem_complexeventitemvariable.py
│ │ ├── 0064_auto_20201005_1443.py
│ │ ├── 0065_auto_20201005_1454.py
│ │ ├── 0066_auto_20201006_0718.py
│ │ ├── 0067_auto_20201006_0719.py
│ │ ├── 0068_auto_20201006_0826.py
│ │ ├── 0069_complexeventgroup_current_level.py
│ │ ├── 0070_auto_20201006_1327.py
│ │ ├── 0071_recordedevent_level.py
│ │ ├── 0072_auto_20201006_1408.py
│ │ ├── 0073_auto_20201007_0858.py
│ │ ├── 0074_complexeventitem_active.py
│ │ ├── 0075_auto_20201007_1609.py
│ │ ├── 0076_mail_html_message.py
│ │ ├── 0077_auto_20201104_1656.py
│ │ ├── 0078_auto_20201123_1906.py
│ │ ├── 0079_devicehandler.py
│ │ ├── 0080_variableproperty_last_modified.py
│ │ ├── 0081_calculatedvariable_periodfield_variablecalculatedfields.py
│ │ ├── 0082_auto_20211112_1043.py
│ │ ├── 0083_auto_20211115_0812.py
│ │ ├── 0084_auto_20211115_1503.py
│ │ ├── 0085_calculatedvariableselector_active.py
│ │ ├── 0086_auto_20211115_1612.py
│ │ ├── 0087_auto_20211116_1329.py
│ │ ├── 0088_auto_20211117_1023.py
│ │ ├── 0089_calculatedvariable_state.py
│ │ ├── 0090_auto_20211117_1239.py
│ │ ├── 0091_auto_20211118_1019.py
│ │ ├── 0092_auto_20211125_1054.py
│ │ ├── 0093_auto_20211125_1256.py
│ │ ├── 0094_move_dictionaries.py
│ │ ├── 0095_auto_20211203_1949.py
│ │ ├── 0096_auto_20211210_0924.py
│ │ ├── 0097_auto_20220118_1046.py
│ │ ├── 0098_alter_device_polling_interval.py
│ │ ├── 0099_alter_dictionaryitem_label.py
│ │ ├── 0100_device_instrument_handler.py
│ │ ├── 0101_complexeventchangevariable.py
│ │ ├── 0102_move_complex_event_variables.py
│ │ ├── 0103_remove_complexevent_new_value_and_more.py
│ │ ├── 0104_rename_complexeventitem_complexeventinput_and_more.py
│ │ ├── 0105_edit_generic_device_protocol.py
│ │ ├── 0106_datasource_datasourcemodel_djangodatabase_and_more.py
│ │ ├── 0107_alter_calculatedvariableselector_period_fields.py
│ │ ├── 0108_remove_calculatedvariable_period_and_more.py
│ │ ├── 0109_alter_variable_value_class.py
│ │ ├── 0110_variable_readable.py
│ │ ├── 0111_devicehandlerparameter.py
│ │ ├── 0112_alter_devicehandlerparameter_value.py
│ │ ├── 0113_variablehandlerparameter.py
│ │ ├── 0114_alter_devicehandlerparameter_value_and_more.py
│ │ ├── 0115_remove_recordeddata_variable_and_more.py
│ │ ├── 0116_variable_pause_recording.py
│ │ └── __init__.py
│ ├── models.py
│ ├── signals.py
│ ├── single_value_datasource/
│ │ ├── __init__.py
│ │ ├── apps.py
│ │ ├── migrations/
│ │ │ ├── 0001_initial.py
│ │ │ └── __init__.py
│ │ └── models.py
│ ├── tests.py
│ ├── utils/
│ │ ├── __init__.py
│ │ └── scheduler.py
│ └── views.py
├── setup.py
├── tests/
│ ├── project_template/
│ │ ├── manage.py-tpl
│ │ └── project_name/
│ │ ├── __init__.py-tpl
│ │ ├── asgi.py-tpl
│ │ ├── settings.py-tpl
│ │ ├── urls.py-tpl
│ │ └── wsgi.py-tpl
│ ├── test.sh
│ ├── test_modbus.sh
│ └── test_without_plugins.sh
└── tox.ini
================================================
FILE CONTENTS
================================================
================================================
FILE: .flake8
================================================
[flake8]
exclude =
build,
.git,
.tox,
tests/.env,
*/migrations/*
extend-ignore = E203
max-line-length = 88
================================================
FILE: .gitignore
================================================
*.log
*.pot
*.pyc
local_settings.py
build
PyScada.egg-info
dist
/.project
docs/_build
/.idea/*
# Emacs backup files
*~
/tests/test/*
/tests/project_template_tmp/*
/docker/nginx/ssl/*
/docker/pyscada/pyscada.zip
/docker/pyscada/project_template.zip
logs_install.txt
logs_docker.txt
/docker/mysql/Dockerfile
/docker/docker-compose.yml
================================================
FILE: .pre-commit-config.yaml
================================================
repos:
- repo: https://github.com/psf/black-pre-commit-mirror
rev: 24.4.2
hooks:
- id: black
exclude: \.py-tpl$
- repo: https://github.com/adamchainz/blacken-docs
rev: 1.18.0
hooks:
- id: blacken-docs
additional_dependencies:
- black==24.4.2
files: 'docs/.*\.txt$'
args: ["--rst-literal-block"]
- repo: https://github.com/PyCQA/isort
rev: 5.13.2
hooks:
- id: isort
- repo: https://github.com/PyCQA/flake8
rev: 7.1.0
hooks:
- id: flake8
- repo: https://github.com/pre-commit/mirrors-eslint
rev: v9.7.0
hooks:
- id: eslint
================================================
FILE: .readthedocs.yaml
================================================
# Read the Docs configuration file for Sphinx projects
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
# Required
version: 2
# Set the OS, Python version and other tools you might need
build:
os: ubuntu-22.04
tools:
python: "3.12"
# You can also specify other tool versions:
# nodejs: "20"
# rust: "1.70"
# golang: "1.20"
# Build documentation in the "docs/" directory with Sphinx
sphinx:
configuration: docs/conf.py
# You can configure Sphinx to use a different builder, for instance use the dirhtml builder for simpler URLs
# builder: "dirhtml"
# Fail on all warnings to avoid broken references
# fail_on_warning: true
# Optionally build your docs in additional formats such as PDF and ePub
# formats:
# - pdf
# - epub
# Optional but recommended, declare the Python requirements required
# to build your documentation
# See https://docs.readthedocs.io/en/stable/guides/reproducible-builds.html
# python:
# install:
# - requirements: docs/requirements.txt
================================================
FILE: AUTHORS
================================================
Current or previous core committers:
* Martin Schröder
* Camille Lavayssiere
Current and previous core designers:
* Martin Schröder
* Camille Lavayssiere
Contributors (in alphabetical order):
* Shannon McCullough
* Gregor Kendzierski
================================================
FILE: CHANGELOG.txt
================================================
0.7.0b2
- fixed modbus daemon
- fixed modbus device
- updated Docs
- readded log notifications in HMI
- added loading animation for data prefetch in HMI
- changed id in Log model to timestame + id schema
0.7.0b3
- removed separate handler files for daq
- removed seperate HMIVariable model
- added restart of daq when Variable or Device model are changed
- added support for different byte order of aquired data
- fixed support for U/INT64 and U/INT32 datatypes
- removed chart_set from hmi
- updated docs
- removed unused code
0.7.0b4
- fixed reinit loop in daq daemon
- added restart of daq when Scaling model has changed
- fixed hmi.widget save without a title
- fixed export.handler (wrong start and end date)
- fixed export to file, check of array index, import of numpy
- added backend table (VariableState) for current values in the database
- fixed crash of hmi admin when widget has no title
- added unixtime value in web hmi (experimental)
- fixed custom html panel variable not uptading in hmi
- added restart_daemon field in background task model
- added check of write permissions for pid and log file in DaemonHandler
0.7.0b5
- added color chooser to VariableAdmin
- fixed display bool values in charts
- added servertime to footer of hmi
- new register handling structure in modbus device
0.7.0b6
- updated javascript libs
- jquery --> 1.12.4
- flot --> 0.8.3
- tablesorter --> 2.0.5b
- bootstrap --> 3.3.6
- changed Title in HMI views
- added pollinginterval field in device model
- fixed chart legend template
0.7.0b7
- fixed data export (record starts with 0)
- fixed RecordedData manager
- added APC UPS status info's to systemstat device
0.7.0b8
- added ability to add fake data to RecordedData manager
- fixed add fake data in hmi
- fixed query_first_value in RecordedData manager
0.7.0b9
- updated to Django 1.10
- changed filter in Chart Model Admin
0.7.0b10
- added Visa and Phant Device support
- minor fixes in the Export of Data
0.7.0b11
- fixed Export without mean values
- fixed managementcommand for Data Export
- added lock for Exports to prevent running of more than one export at a time
0.7.0b12
- fixed export
- added datetime fields to Export
- added pytz to the requirements
0.7.0b13
- fixed modbus write task
- fixed Event handling
0.7.0b14
- fixed handling of int16 values in RecordedData Model
- added custom admin interface
- added filter to variable state admin view
- added unit column to variable admin
0.7.0b15
- added 1-Wire support (experimental)
0.7.0b16
- fixed handling of dead tasks in data export
0.7.0b17
- added support for custom daq devices
- updated docs
- some hmi changes
0.7.0b18
- added OWFS support to onewire device
- updated to django 1.11
- added download link for export files to export job
- fixed daemon handler
0.7.0b19, 0.7.0b20, 0.7.0b21
- changed daemon handling to support multitasking
- rearranged admin for Device and Variables
- updated the Docs
0.7.0b22, 0.7.0b23, 0.7.0b24, 0.7.0b25
- added BackgroundProcess restart on model change
- fixed problem with id of ControlItems in HMI
- updated Docker files (not working yet)
- updated SysV-init service examples
- updated systemd service examples
0.7.0b26
- fixed Jofra350 Admin
- fixed OperationalError in scheduler
0.7.0b27, 0.7.0b28, 0.7.0b29, 0.7.0b30, 0.7.0b31
- major update to the javascript part of the HMI Client
- added time selection bar in HMI
0.7.0rc1
- updated Docs
- updated systemd unit file
- improved HMI
0.7.0rc2
- fixed "-" bug in view link_title
- fixed visa daq restart handler
- fixed hmi "AutoUpdateButton" not working
- updated docs, updated readme
- added utils.blow_up function to convert database data from change of value to constant timestep data
0.7.0rc3
- fixed double connect in visa device
- moved loading animation in hmi
- added 100 ms and 500 ms polling interval (experimental)
- added extension compatibility
- fixed onewire and smbus reinit handler
- added protocol id for the new GPIO Extension
0.7.0rc4
- added missing migration file
0.7.0rc5
- changed the method for namespace packages to the pkg_resources-style
- moved the version info to pyscada.core
0.7.0rc6
- corrected typos
- fixes of AppConfig for setup.py develop
- added protocol id for scripting extension
0.7.0rc7
- added admin for VariableProperty
- added capability of reading and writing VariableProperties from the HMI and devices
- altered arguments for device.write_data!
0.7.0rc8
- changed VariableProperty handling in DeviceWriteTask
- changed VariableProperty handling in HMI
0.7.0rc9
- fixed variable and variable_property attributes in hmi.ControlItem
- added traceback to Device.get_device_instance method
- updated Keithley DMM2000 device in visa.devices
0.7.0rc10
- updated docs
- fixed no data download in pyscada.js
- fixed default polling interval in pyscada.device
0.7.0rc11
- changed widget model to support content from plugins
- changed visable to visible in pyscada.hmi.models.Chart, SlidingPanelMenu, Widget
- some changes for python 3 compatibility in pyscada.export
0.7.0rc12
- fixed issue #13, Mismatch between event limit elif cases and the displayed limit types.
- merged pull request #12, changing from source_format to target_format to match preceding setting of '2H' value
0.7.0rc13
- updated docs, switching from python 2.7 to python 3
- added redirect to https to the nginx sample config
- fixed server error for BackgroundProcess View in Admin with python3
- fixed HDF5 export for python 3
- fixed ProcessFlowDiagram in HMI
- added support for multiple SlidingSidePanels on one Side
- added date_saved field to the RecordedData Model, renamed the RecordedData model without the field to RecordedDataOld,
migration #48 will copy some data to the new model, the rest can be copied by using the move_data.py script
0.7.0rc14
- update to flot 2.1.6
- fixed process flow diagram value not displayed
- moved x y zoom selection in HMI to each Chart
- add option of redirecting to a custom login page
- add framer option for modbus communication
- add data courser in chart
- add XYChart
- add new form widget in HMI
- add new drop down control element in HMI
- fixed WidgetContent not being deleted
- moved signal related methods to dedicated signals.py
- added pyserial to dependency list
- improved hmi <--> db communication to avoid data loss on slow connections
0.7.0rc15
- fixed zombi process problem
- fixed migrations with python3
- changed datetime_now to now from django timezone
0.7.0rc16
- fixed re-login after logout (#22)
- added LINK_TARGET option to change the default behaviour of links in view overview (#23)
- Catching exceptions if DB close while pyscada is running
0.7.0rc17, 0.7.0rc18
- add pre_delete signals to stop the background process before deleting a device
- move widget post_save signal to the model to remove the global receiver (not filtering by sender)
- move device handlers to core
- add stop in DAQ Process restart
- move the device and variable protocol specific configuration to core
- add protocol name in device __str__ for the variable js admin file
- add complex events
0.7.0rc19
- add fk_name in admin for bacnet device with 2 ForeignKey to Device model
0.7.0rc20
- add django channels to send informations between processes
0.7.0rc21
- Update docker config file
- Add optional PID_FILE_NAME to settings to allow multiple instances
- Add custom periodic auto caltulated variable
0.7.0rc22
- Add choose_login.html to have multiple login ways
- Add circular gauge to display control items
- Add silent delete option in admin for VariableState and Device to delete a lot of data
- Add grafana doc and config file to use Grafana to display data from a PyScada instance
- Add dictionaries to store string with a key. Allows to store strings for Variables
0.7.0rc23
- Add svg to render ProcessFlowDiagram. Allows to resize to fit the window size
- Add OPC-UA protocol
- close DB connection in scheduler to allow multiple instance on the same DB to run
- Add INT8 and UINT8 variable value class
- change the date range picker JS library
- Add logrotate config file
- Add a slider to change the refresh rate value of data handling
0.7.1rc1
- Update to Django 3
- Update docker config and doc to use pyscada repository
0.7.1rc2
- Move group display permission items to inline and add exclude type for each item
- fix adding a new device and activate device in protocol process list
- fix signals for BP not done nor failed
- add theme files validator
- other fixes
0.7.1rc3
- add bar chart
- add polling intervals
- add view theme
- add -config2 div in html to get all infos of items used in the user interface
- add calculated variable for aggregation
- add install script
- add css class arg to customize widget
- fixes
0.7.1rc4
- Add MBus to protocol list
- add append and remove dictionary functions
- Fix device write task for VP (no variable defined)
- HTML: add span for legendLabel text
- JS: load visible chart variable first
- fixes
0.7.1rc5
- add hide/show JS for fields in admin
- add get_prev_value overwritten by child class for systemstat non logging variable
- last_value use get_prev_value
- add systemstat timestamps
- add file protocol
- fix DeviceWriteTask for variable to change in complex events
- add value using get_prev_value in views.py for non logging variables
- Move handler to Device model.
- Wait 5 seconds to read the main pid (scheduler)
0.8.0
- core : fix when no handler selected to use the GenericHandlerDevice of the selected protocol
- systemstat : Create systemstat device (allow remote over ssh)
- core : Fix timestamp not integer in RecordedData init
- systemstat : process pid find in cmdline and not only in processus name
- systemstat : fix pre_delete signal and information choice name
- core : fix config2 and add classes
- systemstat : add write_data to execute command
- JS : fixes
- core : fix protocol list for devices
- hmi : fix color for control items
- core : add related models to Config2
- JS : dateTimePicker Event : send pyscadaDateTimeChange event for all objects with the class pyscadaDateTimeChange when the datetime picker value change.
- various : replace ugettext_lazy by gettext_lazy
- core : replacing pyscada.core in INSTALLED_APPS by pyscada
- hmi : replace django.conf.urls.url by django.urls.path
- all : Moving to AGPL3 License
- core : Moving to django 4.2
- docs : fixed urls in the docs
- added a testscript for the instalation routine
- core : display value option refactoring. Control items display value option code refactoring. Allows more than 3 color.
- fix django requirements. It should be a coma separated list.
- moved to new namespace packet format (PEP420) : this was nessesary to make the use of venv possible
- Fix django 4.0 login : change the default value for LOGIN_REDIRECT_URL in settings.py
- Fix django 4.0 CSRF_TRUSTED_ORIGINS : change the nginx config to forward the protocol used (http or https) because : Changed in Django 4.0: The values in older versions must only include the hostname (possibly with a leading dot) and not the scheme or an asterisk.
- Fix when a plugin is uninstalled but the WidgetContent defined in this plugin remain and is selected in an active widget. Add an information log.
- modbus : fix migration test
- update install shell : system and docker options
- modbus : fix test : remove pyvisa from settings template
- HMI GroupDisplayPermission no groups :
- add GroupDisplayPermission for users without any group (blank=True).
- auto create in the hmi/0072 migration.
- this GroupDisplayPermission cannot be deleted in the admin interface.
- this group allow everything by default (exclude is empty for each OneToOne related model).
- add ValidationError for duplicate GroupDisplayPermission.
- auto collapse only empty inlines in GroupDisplayPermission admin.
- update get_group_display_permission_list in utils.
- use get_group_display_permission_list in read and write task.
- CompexEvent with multiple output variables and refactoring
- Change names :
- * ComplexEventGroup > ComplexEvent
- * ComplexEvent > ComplexEventLevel
- * ComplexEventItem > ComplexEventInput
- add ComplexEventOutput to set multiple output variable values when a ComplexEventLevel is active or when no level in active for a ComplexEvent.
- Remove unused import
- add informations to pyscada.mail
- init_db for event and mail add pyscada.core to installed app in init_db
- use concurrent_log_handler to rotate logs
- remove django_cas_ng config from settings
- send mails to admins and managers
- force channel layer to be empty
- since the version 4 of channel redis version, the channel layer is not
- empty after the first read
- we read it again to empty it
- maybe it is related to
- django/channels_redis#348
- or to django/channels_redis#366
- Create background process for generic device
- use id 16 for the generic process worker as 1 is taken by the scheduler
- but id 1 is taken for generic protocol id
- by defaut the generic device don't do nothing
- use the dummy handler to save
- Allow millisecond timestamp for recorded data
- Replace time() by time_ns / 1000000000 in
- GenericDevice (write)
- GenericHandlerDevice (time)
- RecordedData (init)
- Do not force timestamp in recorded data init to be integer beforce id calculation.
- add handler for dummy waveforms
- Create waveforms for a generic device.
- Type can be sinus, square and triangle.
- Properties are set using variable properties: type, amplitude, start_timestamp, frequency and duty cycle.
- Variable Property type should be a string.
- default is:
- "type": "sinus", # sinus, square, triangle
- "amplitude": 1.0, # peak to peak value
- "start_timestamp": 0.0, # in second from 01/01/1970 00:00:00
- "frequency": 0.1, # Hz
- "duty_cycle": 0.5, # between 0 and 1, duty cycle for square and for
- triangle : Width of the rising ramp as a proportion of the total cycle.
- Default is 1, producing a rising ramp, while 0 produces a falling ramp.
- width = 0.5 produces a triangle wave. If an array, causes wave shape to
- change over time, and must be the same length as t.
- log for device write task : log when DWT for a variable not writeable
- fix boolean with display option
- use button.html for boolean with display options and for non boolean with color only display option
- add span for display button : use this span to display the value next to the control item label
- fix variable property control item
- fix dictionary, color for VP
- merge number and boolean in update data values to simplify the code
- remove unused boolean classes
- add offset property to generic waveform handler
- send mail fail not silently : show the error message in a warning log
- refactor logs
- remove some error logs
- replace error logs by warning logs
- use f-strings in error logs
- add exc_info=True to log traceback and send it to ADMINS (see settings.py)
- log as error when a process failed 3 times (to send a mail to ADMINS) then log as warning
- set AdminEmailHandler settings
- update gitignore for docker
- fix export when a filename is given
0.8.1
- remove docker files created during the installation process
- docker install
- hide db password input
- remove need of django installed in the host system
- check if zip is installed
- system install
- hide db password input
- add input informations
- Update conf.py :
- removed sphinx.ext.autodoc : removed sphinx.ext.autodoc and therefore the dependency of import django this will fix the rtfd build
- added author : added Camille Lavayssiere as an author
- removed sphinx_js : this will fix the rtfd build
- fix license classifier for pypi
- fix install log
- JS : hide loading state : if the value of the loading state is >= 100 we hide the loading state.
- HMI: set navbar as fixed : remove relative position for the top navbar, add body padding for the pages content
- add css class to widget content models
- cascade control item deletion on process flow diagram item
- migration for css class length
- allow to delete the process flow diagram background image
- fix process flow diagram item str : if related control item label is empty, return the process flow diagram id
- remove process flow diagram image padding top
- add template variable to replace the site name : default to PyScada
- Variable admin site rendering : add hideshow JS to Variable, load protocol variable fk_name, FormSet, fieldsets in the inlines
- widget offset : now the column parameter for a widget will be respected, if a widget is in column 1 (from 0 to 3) and there is no other widget on the same page and row the widget will be offsetted this allow respecting the widget positioning with different windows size in comparaison of adding an widget with an empty html content
- doc use main branch for install
- pyscada installation in venv
- add developer and plugin installation documentation
- added pyscada-ems to the list of device protocols
- changed plugins url handling : the url settings of pyscada plugins will be added to the global urls, config automaticly
- Fix device read task str without variable or variable property
- add email timeout for error log to admins
- add traceback to error logs
- dictionary append item function : allow to update the label or the value if exist, else create
- add hidden variable-config for process flow diagram items
- add h5py import error log
- JS : timestamp conversion : if string value is a float, convert to float
- allow to use dictionary for timestamp variable : if a value is in the dictionary it will not be converted to a datetime string
- remove log for calculated variable
- add info to recorded data log if it already exist
- fix getting objects for html : fix exclude list for many2many objects
- add class to change process flow diagram items color
- set bool false control input display value color to grey
- add 403 error template displaying the exception message
- display message error on view list : on view not found (permission) and multiple views (duplicate link_title views)
- add core urls exception : log only if pyscada plugin has an urls.py file
- add mysqlclient dependency
- fix python venv install : add venv path to PATH
- add scipy to requirement for the waveform generic handler
- missing python3-venv requirement for venv install
- install-venv : missing PATH for django startproject
- replace setuptools find_packages by find_namespace_packages
- fix doc for ems protocol
- add exclude field list for gen_hiddenConfigHtml
- fix install in venv (partially broken by black formatting commit) :
- add python3-venv dependency
- add write right for settings template file to add install context
- run django code using pyscada user and venv
- add scipy for generic waveform handler
- fixed page alignment problem in views : when the user clicked on the page link in a view a second time the page has been moved so that the top of the page is below the navbar, this was not intended, the page should be hirisontaly aligned at the bottom of the navbar.
- JS : add event to anounce control item color change :
- event is linked to the control item config2 element
- event name is : "changePyScadaControlItemColor_" + control_item_id
- event.detail is the color formatted as #45bc65
- fix page anchor position to include navbar padding and border
- group display permisson :
- Fix for chart, custom html panel, pie, process flow diagram.
- Make the list of objects permissions more generic to allow any WidgetContentModel to be added.
- update tablesorter :
- to version 2.31.3 : https://github.com/Mottie/tablesorter
- fix sorting non working for unit
- remove unused logos
- create option column
- add LOGOUT_REDIRECT_URL : redirect to site home rather than django admin logout page after logout
- pip3 install user : use pyscada user to run install with pip
- calendar first day : set first calendar day to monday
- fix setting text for boolean value : check if the span field with class .boolean-value exist before writting the value for svg process flow diagram item the method is different so the span does not exist, todo : replace value by string for process diagram items
- aggregation type : check if '#aggregation-type-all-select-' + widget_id exist before adding new option
- Fix day name order and let first day to monday:
- The daysOfWeek order for DateTimePicker should start on sunday, if not the days are not well labeled. Then the firstDay select the first day to start weeks in the calendar
- The first day is set to monday untill we find how to get the browser locale and use the first week day for that country
- fix measurement_data_dumps location : set measurement_data_dumps directory in pyscada home during the venv installation use that folder in default settings.py
- replace save method by get_or_create for dictionary items : don't create it if it already exist
- add JS variable to for on before reload : if ONBEFORERELOAD_ASK is true, ask the user before reload o leaving the page, else don't ask
- fix query first value when no data found in time range : query_first_value in RecordedDataValueManager.db_data find last element from time=now when no data was found for a variable in the time range specified if data was found, time=time of first value
- fix the 1st diagram tooltip (was hidden by overflow)
- dispatch changePyScadaControlItemColor event on window : simplify the event catching
- load hidden config2 after view html load : to load the view quickly load the hidden config2 after the loading the view html code
- JS: load config2 before the pyscada hmi init then send event : Load config2, Init the pyscada hmi, send PyScadaCoreJSLoaded for plugins
- add loading page with svg icon : can be replaced by the loading_page block, default icon color (000, black) can be change with svg_loading_color, for example: svg_loading_color="00f"
- kill setTimeout and xhr request on page unload : store all timeouts in the PYSCADA_TIMEOUTS dictionary, store the current xhr blocking request in PYSCADA_XHR variable
- JS: add PyScada HMI at the beginning of each console.log
- add an event for a variable when data change to allow plugin do a custom action
0.8.2
- prevent loading and showing data after DATA_TO_TIMESTAMP: the bug was that the timestamp_to for the data handler ajax query could be higher than DATA_TO_TIMESTAMP and then change the datepicker end value after the ajax request finish
- fix generic device init import
- last_element_min_time: set to 0 if no min time set
- add transform data and template for control item display value: allow to control the data (transform data function) and graphical representation (template) of a control item set to display value
- add sliceDATAusingTimestamps JS function to get DATA for a variable key using the daterangepicker and the timeline slinder
- add "Template not found" template
- fix difference percent period calculation
- add readthedocs config file: from : https://docs.readthedocs.io/en/stable/config-file/
- update docs
- add operations and aggregation protocols
- migration: update Chart WidgetContent if exist
- plugin can add apps to INSTALLED_APPS in settings: a plugin can specify additional apps to add to INSTALLED_APPS
- in the __init__.py file of the plugin (in pyscada/pluginName) add a list named : additional_installed_app = ["pyscada.otherAppX", "pyscada.otherAppY"]
- exemple in the pyscada-operations plugin.
- get_objects_for_html check if field.name is attr of obj
- add DataSourceModel, Datasource and DjangoDatabase
- DataSourceModel :
- Used to define a data source type.
- The data source base model have a foreign key to this model to specify the configuration :
- the name,
- can add, modify on select in the admin panel,
- the model name of the inline having the specific config (fields, functions, manager).
- DataSource :
- The base model for all the data sources.
- A data source needs to inherit from this class, and should have the basic functions :
- last_value,
- read_multiple,
- write_multiple,
- get_first_element_timestamp,
- get_last_element_timestamp.
- DjangoDatabase :
- Specify a table to store the values. The table model should have a manager similar to the RecordedDataManager (functions).
- The default data source added is the RecordedData table.
- To add new data source, look at the example in pyscada-operations.
- add VariableManager, rename and update RecordedDataManager
- To switch to the data source architecture, use the VariableManager function in order to :
- filter Variable list by datasource (_get_variables_by_datasource)
- read values from datasources (read_multiple)
- write values to datasources (write_multiple)
- get first timestamp recorded for a variable list (get_first_element_timestamp)
- get last one (get_last_element_timestamp)
- Plugins and handlers should not use directly the RecordedDataManager but the VariableManager in order to talk to differents data sources.
- Look at the new way to save read data from GenericDevice and GenericDeviceHandler in pyscada/device.py and in the pyscada.operations plugin.
- Delete CalculatedVariable (moved to the pyscada.operations plugin) in order to not loose your calculated variables you should install pyscada.operations plugin before running the pyscada migration 108.
- log ProgrammingError and OperationalError while populating models
0.8.3
- add view timedelta option to change de default time delta
- add control item offset option: to choose how to display or not data before the time range
- generic function to populate inlines for device, variable, variablestate
- RecordedData: store uint64 as int64 shifted - unknown class as float: uint64 are shifted by -9223372036854775808 = 2**63 to be stored as a django BigIntegerField
- handler: add erase cache option in read data all: in order to call various times read data all in a handler, allow to not erase the cached results
- upgrade flot to 4.2.6
- limit legend max height to the chart height
- fixes and other small updates
0.9.0
- fix glyficon alert and excalamation sign
- fix append dictionary item if multiple items : keep the first item and delete the others
- device handler found and content : show if handlers are found in the handler list, show the content of a handler or the pyscada_admin_content variable content if it exists in the handler file
- JS: check if moment exist before daterangepicker init
- added option to set a custom message for processes : run by the background-process scheduler, this is e.g. useful for kepping track of the state of single shot tasks.
- JS: update control-item type-numeric if no color_only option
- add view object to the template context
- use fetch api for data handling (#181) : remove use of ajax for data handling, better handle timeout, deauthenticate, use JS function instead of jQuery
- fixed all values=0 in, filename is None error, h5 timestamp format data export :
- export jobs will be markt as faild now
- the min and max time check is removed because it only checks the first variable
- fixed unit mismatch timestamps from read_multiple in ms, export expected them in s
- added more detailted status output to backgroundtask model
- changed timestamp format for h5 output from matlab to unix timestamps
- escape of "/" in variable name to prevent dataset generation in h5 and mat files
- fix time max to find previous last element
- add app init after scheduler start : in order to allow plugin to run code at start and not use the AppConfig.ready function
- allow a plugin to add a cov notification : a plugin can define a function to custom send cov notification add it in AppConfig as: def pyscada_send_cov_notification(self, variable)
- JS: variable to disable default data handling : Use to provide other data handling in a plugin
- check the rights of users in a view to read or write data : any model which has a group display permission or any WidgetContentModel subclass model shoud have a data_objects function. This function return a dict of:
- variable or variable_property the user is allowed to read data from
- variable_write and variable_property_write the user is allowed to write to
- add the view id to requests (get_cache_data, write_task and write_property)
- upgrade to django >= 5.2
- JS: compare new and old color before updating color and sending event
- remove pkg_resources import and setuptools dependency : replaced by importlib.metadata, see https://setuptools.pypa.io/en/latest/pkg_resources.html
- add numpy requirement and remove hdf5-103 which is in hdf5-dev
- remove access to not visible view
- fix variable protocol save and delete : when saving a variable, the related variable protocol (modbusvariable for example) should be saved , even if the modbus variable config is empty. When changing the device of a vaiable, if the protocol change, (modbus to visa for example), the related modbus variable should be deleted and the visa variable should be created.
- add tests for read values : fix timestamp and date_saved_max to pass the tests
- add js tests to add fetched data : fix fetched data fucntion to pass the tests
- Add device and variable handler parameters
- Allow anonymous access : use the anonymous group display permission to configure and allow in the settings using PYSCADA_ALLOW_ANONYMOUS and PYSCADA_ALLOW_ANONYMOUS_WRITE
- home page is set in settings using PYSCADA_HOME
- added option to add links to external urls in the view-overview
- renamed write_multible, read_multible, last_value to write_datapoints, query_datapoints and last_datapoint to make the funktion more clear
- added last_datapoint, query_datapoints, write_datapoints, write_raw_datapoints to Variable model as a shortcut to Variable.objects.METHOD(variable=self)
- consolidated unit of timestamps internaly to s in python and ms in JS code
- general code cleanup
- removed unused filter_time and get_values_in_time_range method from RecordedDataManager
- removed unused get_first_element_timestamp from DjangoDatabase datasource
- moved DjangoDatasource to separate sub app -> Update of settings.py is nessesary, see update.rst
- migrated from setup.py to pyproject.toml
- updated device_protocol list to include MQTT and Influxdb plugins
- added new datasource to store values only in the cache
- added new datasource to store only the most recent value in the database
================================================
FILE: LICENSE
================================================
GNU AFFERO GENERAL PUBLIC LICENSE
Version 3, 19 November 2007
Copyright (C) 2007 Free Software Foundation, Inc.
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU Affero General Public License is a free, copyleft license for
software and other kinds of works, specifically designed to ensure
cooperation with the community in the case of network server software.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
our General Public Licenses are intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
Developers that use our General Public Licenses protect your rights
with two steps: (1) assert copyright on the software, and (2) offer
you this License which gives you legal permission to copy, distribute
and/or modify the software.
A secondary benefit of defending all users' freedom is that
improvements made in alternate versions of the program, if they
receive widespread use, become available for other developers to
incorporate. Many developers of free software are heartened and
encouraged by the resulting cooperation. However, in the case of
software used on network servers, this result may fail to come about.
The GNU General Public License permits making a modified version and
letting the public access it on a server without ever releasing its
source code to the public.
The GNU Affero General Public License is designed specifically to
ensure that, in such cases, the modified source code becomes available
to the community. It requires the operator of a network server to
provide the source code of the modified version running there to the
users of that server. Therefore, public use of a modified version, on
a publicly accessible server, gives the public access to the source
code of the modified version.
An older license, called the Affero General Public License and
published by Affero, was designed to accomplish similar goals. This is
a different license, not a version of the Affero GPL, but Affero has
released a new version of the Affero GPL which permits relicensing under
this license.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU Affero General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Remote Network Interaction; Use with the GNU General Public License.
Notwithstanding any other provision of this License, if you modify the
Program, your modified version must prominently offer all users
interacting with it remotely through a computer network (if your version
supports such interaction) an opportunity to receive the Corresponding
Source of your version by providing access to the Corresponding Source
from a network server at no charge, through some standard or customary
means of facilitating copying of software. This Corresponding Source
shall include the Corresponding Source for any work covered by version 3
of the GNU General Public License that is incorporated pursuant to the
following paragraph.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the work with which it is combined will remain governed by version
3 of the GNU General Public License.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU Affero General Public License from time to time. Such new versions
will be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU Affero General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU Affero General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU Affero General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
Copyright (C)
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see .
Also add information on how to contact you by electronic and paper mail.
If your software can interact with users remotely through a computer
network, you should also make sure that it provides a way for users to
get its source. For example, if your program is a web application, its
interface could display a "Source" link that leads users to an archive
of the code. There are many ways you could offer source, and different
solutions will be better for different programs; see section 13 for the
specific requirements.
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU AGPL, see
.
================================================
FILE: MANIFEST.in
================================================
include AUTHORS
include LICENSE
include README.rst
include CHANGELOG.txt
recursive-include pyscada/templates *
recursive-include pyscada/fixtures *
recursive-include pyscada/hmi/fixtures *
recursive-include pyscada/hmi/templates *
recursive-include pyscada/hmi/static *
recursive-include pyscada/core/*
recursive-include pyscada/django_datasource/*
recursive-include docs *
recursive-exclude * *.pyc
recursive-exclude pyscada/report *
================================================
FILE: README.rst
================================================
PyScada a open source SCADA system
==================================
A Open Source SCADA System with HTML5 HMI, build using the Django framework. If you like to setup your own SCADA system head over to http://pyscada.rtfd.io.
Features
--------
* HTML5 based HMI
* Supports the following
* industrial Protocols
* `Modbus `_ TCP/IP - RTU - ASCII - Binary (using `pyModbus `_)
* `Phant `_ (see http://phant.io/)
* `VISA `_ (using `pyVISA `_)
* `1-Wire `_
* `BACNet/IP `_ (in development) (using `BACpypes `_ and `BAC0 `_)
* `MeterBus (MBus) `_ (in development) (using `pyMeterBus `_)
* `SMBus `_ (using `smbus2 `_)
* `GPIO `_ (using `RPi.GPIO `_)
* `SystemStat `_
* `OPC-UA `_ (using `opcua-asyncio `_)
* `SML (Smart Meter Language) `_ (using `pySML `_)
* `File read/write `_
* `Serial `_
* `WebService `_
* devices
* Generic dummy device
* `PT104 `_ (using `Pico PT-104 `_)
* scripts
* `Scripting `_
* system tools
* `EMS `_
* event management, data export, mail notification
* very low Hardware requirements for the server
Structure
---------
.. image:: https://github.com/pyscada/PyScada/raw/master/docs/pic/PyScada_module_overview.png
:width: 600px
Dependencies
------------
- core/HMI
* python>=3.8
* django==4.2
* numpy>=1.6.0
* pillow
* python-daemon
What is Working
---------------
- Modbus TCP/RTU/BIN
- Visa (at least for the devices in the visa/devices folder)
- Systemstat
- OneWire (only DS18B20)
- phant (no known issues)
- smbus (at least for the devices in the smbus/devices folder)
- gpio (at least for the raspberry pi)
- webservice (json and xml parsing)
- systemstat
- scripting
- event (no known issues)
- export (no known issues)
- hmi (no known issues)
What is not Working/Missing
---------------------------
- Documentation
- SysV init daemon handling
- BACNet (due to the lack of hardware to test)
- OPC-UA (need more tests)
- MeterBus (need more tests)
Installation
------------
Detailed installation instruction can be found at: http://pyscada.rtfd.io .
Contribute
----------
- Issue Tracker: https://github.com/pyscada/PyScada/issues
- Source Code: https://github.com/pyscada/PyScada
License
-------
The project is licensed under the _GNU Affero General Public License v3 (AGPLv3).
================================================
FILE: docker/docker-compose.yml-tmp
================================================
version: '3'
services:
pyscada:
build: pyscada
container_name: pyscada
#volumes:
tty: true
depends_on:
- db
volumes:
- "http:/src/pyscada/http"
- "sock:/src/pyscada/tmp"
nginx:
image: nginx:latest
build: nginx
container_name: nginx
ports:
- "80:80"
- "443:443"
volumes:
- "http:/var/www/http"
- "sock:/tmp"
depends_on:
- pyscada
db:
image: mysql
container_name: mysql
restart: always
environment:
MYSQL_RANDOM_ROOT_PASSWORD: 'yes'
MYSQL_DATABASE: 'PyScada_db'
MYSQL_USER: 'PyScada-user'
MYSQL_PASSWORD: 'PyScada-user-password'
volumes:
- dbdata:/var/lib/mysql
volumes:
http:
sock:
dbdata:
================================================
FILE: docker/mysql/Dockerfile-tmp
================================================
## Pull the mysql:5.6 image
FROM mysql:latest
## The maintainer name and email
LABEL maintainer="PyScada | Martin Schröder `
(*TODO link to createsuperuser* doc).
.. image:: pic/frontend_login.png
After successful login in your see the view overview, to open the admin panel
click on your username in the upper right corner and on *Admin*.
.. image:: pic/frontend_view_overview_admin_empty.png
Now you are in the backend or Admin panel.
.. image:: pic/backend_overview.png
Add a new Device
----------------
To add a new device (e.g. a PLC) open the *Device* Table in the *PyScada Core*
section.
.. image:: pic/backend_core_add_device.png
You will see a empty list. Click on *add device* in the upper right
corner to add a new device (e.g. a modbus device).
.. image:: pic/backend_save_device.png
* Enter a name and a description.
* Choose a pooling interval (time between two variable value read).
* Choose a protocol.
* Enter the necessary informations for that protocol.
(*TODO device protocol setup*)
.. image:: pic/backend_save_modbus_device.png
Add a new Variable
------------------
Enter to *Variables* table in the *PyScada Core* section of the admin panel.
Click on *add variable* in the upper right corner.
.. image:: pic/backend_core_add_variable.png
A Variable has a name and a description, assign the Variable to a Device and
select a Unit of measurement (*TODO* add description off adding a new unit),
activate writable if the value should be changed from the HMI, if the value has
to be scaled in order to be displayed right select the right scaling
(*TODO* add description for adding a scaling).
The *value_class* is the data type in witch the value is represented on the Device
(*TODO* add example).
The *Change Of Value (COV)* is the amount of change of the value to be stored in
the database. It will store new values for that variable if :
.. math::
| new\_value - last\_value | > COV\_value
or if the last value is older than 1 hour.
So if you want to save all the values, set the COV to ``-1``.
.. image:: pic/backend_core_save_variable.png
Enter the necessary informations for the variable depending of the device protocol.
Short instructions to build the user HMI (frontend)
---------------------------------------------------
In the backend HMI section:
1. Charts, add a new Chart
2. Page, add a Page
3. Widget, add a Widget, select under Page the page you added in 2. and under `Content` the Chart from 1.
A widget controls the position of every element on a Page.
Set the position (row, column) and the width of the widget.
4. View, add a View and select the page from 2.
5. (optional) GroupDisplayPermissions, add a new GroupDisplayPermission, (if nessesary add a new Group and add your User to that Group, select all items you created in 1. to 4.)
6. open http://IP/, you should see the new View, if the DAQ is running and there is Data already in the DB, you should see the last 2 Hours of data and the current Data.
The frontend structure :
::
+-View------------------------------------+
| |
| +-Page--------------------------------+ |
| | | |
| | +-Widget--------+ +-Widget--------+ | |
| | | | | | | |
| | | Row 1, Col 1 | | Row 1, Col 2 | | |
| | | Width 1/2 | | Width 1/2 | | |
| | | +-Chart-----+ | | +-Chart-----+ | | |
| | | | | | | | | | | |
| | | +-----------+ | | +---------- + | | |
| | +---------------+ +---------------+ | |
| +-------------------------------------+ |
+-----------------------------------------+
Add a new View
--------------
to be continued...
Add a new Page
--------------
to be continued...
Add a new Chart
---------------
to be continued...
Add a new Control Panel
-----------------------
to be continued...
================================================
FILE: docs/command-line.rst
================================================
Command-line
============
Restart the PyScada Daemons
---------------------------
systemd:
.. code-block:: shell
sudo systemctl restart pyscada
Restart Gunicorn
----------------
systemd:
.. code-block:: shell
sudo systemctl restart gunicorn.service
Restart NGINX
-------------
systemd:
.. code-block:: shell
sudo systemctl restart nginx
Get Installed PyScada Version
-----------------------------
.. code-block:: shell
cd /var/www/pyscada/PyScadaServer
sudo -u pyscada python3 manage.py shell
import pyscada
pyscada.core.__version__
exit()
Export Recorded Data Tables
---------------------------
.. code-block:: shell
sudo -u pyscada python3 manage.py PyScadaExportData # last 24 houres
sudo -u pyscada python3 manage.py PyScadaExportData --start_time "01-03-2015 00:00:00" # from 01. of March 2015 until now
# from 01. of March until now, with the given filename
sudo -u pyscada python3 manage.py PyScadaExportData --start_time "01-Mar-2015 00:00:00" --filename "filename.h5"
# from 01. of March until 10. of March, with the given filename
sudo -u pyscada python3 manage.py PyScadaExportData --start_time "01-03-2015 00:00:00" --filename "filename.h5" --stop_time "10-03-2015 00:00:00"
================================================
FILE: docs/conf.py
================================================
# -*- coding: utf-8 -*-
#
# Configuration file for the Sphinx documentation builder.
#
# This file does only contain a selection of the most common options. For a
# full list see the documentation:
# http://www.sphinx-doc.org/en/master/config
# -- Path setup --------------------------------------------------------------
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#
# import os
# import sys
# sys.path.insert(0, os.path.abspath('.'))
# -- Project information -----------------------------------------------------
project = "PyScada"
copyright = "2023, Martin Schröder, Camille Lavayssiere"
author = "Martin Schröder, Camille Lavayssiere"
# The short X.Y version
version = ""
# The full version, including alpha/beta/rc tags
release = "0.8.3"
# -- General configuration ---------------------------------------------------
# If your documentation needs a minimal Sphinx version, state it here.
#
# needs_sphinx = '1.0'
# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = []
# Set JavaScript source paths
js_source_path = "../pyscada/hmi/static/pyscada/js/pyscada"
# Add any paths that contain templates here, relative to this directory.
templates_path = ["_templates"]
# The suffix(es) of source filenames.
# You can specify multiple suffix as a list of string:
#
# source_suffix = ['.rst', '.md']
source_suffix = ".rst"
# The master toctree document.
master_doc = "index"
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
#
# This is also used if you do content translation via gettext catalogs.
# Usually you set "language" from the command line for these cases.
language = "en"
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This pattern also affects html_static_path and html_extra_path .
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]
# The name of the Pygments (syntax highlighting) style to use.
pygments_style = "sphinx"
# -- Options for HTML output -------------------------------------------------
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
html_theme = "default"
# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
# documentation.
#
# html_theme_options = {}
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
# html_static_path = ['_static']
# Custom sidebar templates, must be a dictionary that maps document names
# to template names.
#
# The default sidebars (for documents that don't match any pattern) are
# defined by theme itself. Builtin themes are using these templates by
# default: ``['localtoc.html', 'relations.html', 'sourcelink.html',
# 'searchbox.html']``.
#
# html_sidebars = {}
# -- Options for HTMLHelp output ---------------------------------------------
# Output file base name for HTML help builder.
htmlhelp_basename = "PyScadadoc"
# -- Options for LaTeX output ------------------------------------------------
latex_elements = {
# The paper size ('letterpaper' or 'a4paper').
#
# 'papersize': 'letterpaper',
# The font size ('10pt', '11pt' or '12pt').
#
# 'pointsize': '10pt',
# Additional stuff for the LaTeX preamble.
#
# 'preamble': '',
# Latex figure (float) alignment
#
# 'figure_align': 'htbp',
}
# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title,
# author, documentclass [howto, manual, or own class]).
latex_documents = [
(master_doc, "PyScada.tex", "PyScada Documentation", "Martin Schröder", "manual"),
]
# -- Options for manual page output ------------------------------------------
# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [(master_doc, "pyscada", "PyScada Documentation", [author], 1)]
# -- Options for Texinfo output ----------------------------------------------
# Grouping the document tree into Texinfo files. List of tuples
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
(
master_doc,
"PyScada",
"PyScada Documentation",
author,
"PyScada",
"One line description of project.",
"Miscellaneous",
),
]
html_context = {
"display_github": True, # Integrate GitHub
"github_user": "pyscada", # Username
"github_repo": "PyScada", # Repo name
"github_version": "master", # Version
"conf_py_path": "/docs/", # Path in the checkout to the docs root
}
================================================
FILE: docs/control_item.rst
================================================
Control item
============
Control items are elements of crontol panels which have two functions by default:
- display the last value of a variable,
- control the value of a variable.
To create one in the administration interface, you need at least to:
- enter a label,
- select a variable OR a variable property.
- chose a type : display the value or control the value of the variable/variable property,
You can also:
- select the order in the control panel using the position attribute : lower is at the top of the control panel,
- add options using display value options or control element options.
Display value options
---------------------
It allows adding options to a control item configured to display value.
To create one in the administration interface, you need at least to:
- enter a title,
- choose a template to change the graphic rendering,
- choose if you want to replace a timestamp value by a human readable format,
- transform the data before show it in the user interface: see section below,
- apply color levels: see section below.
### Transform data
#### Usage (configuration)
You can use a data transformation to pass the data through a function before displaying it (for example, display the minimum of the variable in the selected time range).
You may need to specify additional information at the bottom depending on the tranformation needs (as for the Count Value transformation).
#### Creation (developer)
A plugin can add a new transform data to the list.
To do so you can create them automatically in the *ready* function of the *AppConfig* class in *apps.py*.
Have a look at the [*hmi.apps.py*](https://github.com/pyscada/PyScada/blob/main/pyscada/hmi/apps.py).
The fields of a transform data are :
- inline_model_name : the model name to add an inline to the admin page which can add additional fields needed by the transform data function (as TransformDataCountValue for the Count Value function),
- short_name : the name displayed in the admin interface,
- js_function_name : the name of the JavaScript function which will be called to transform the data,
- js_files : a coma separated list of the JavaScript files to add,
- css_files : a coma separated list of the CSS files to add,
- need_historical_data : set to True if the transform data function needs the variable data for the whole period selected by the date time range picker, set to False if it only needs the last value.
### Template
You can choose a specific template to display you control item.
#### Creation (developer)
A plugin can add a new control item template.
To do so you can create them automatically in the *ready* function of the *AppConfig* class in *apps.py*.
Have a look at the [*hmi.apps.py*](https://github.com/pyscada/PyScada/blob/main/pyscada/hmi/apps.py).
The fields of a template are :
- label the template name to display,
- template_name : the file name to use,
- js_files : a coma separated list of the JavaScript files to add,
- css_files : a coma separated list of the CSS files to add.
================================================
FILE: docs/develop.rst
================================================
.. IMPORTANT::
To use PyScada in developer mode, you should install it using the `pip editable mode (-e) `_
For developers
==============
Activate PyScada virtual environment
------------------------------------
.. code-block:: shell
source /home/pyscada/.venv/bin/activate
Cloning the repository
----------------------
.. code-block:: shell
git clone git@github.com:pyscada/PyScada.git
For a plugin like PyScada-Modbus :
.. code-block:: shell
git clone git@github.com:pyscada/PyScada-Modbus.git
Pip editable installation
-------------------------
After activating the virtual environment :
.. code-block:: shell
sudo -u pyscada -E env PATH=${PATH} pip3 install -e ./PyScada
For a plugin like PyScada-Modbus :
.. code-block:: shell
sudo -u pyscada -E env PATH=${PATH} pip3 install -e ./PyScada-Modbus
Restarting the application
--------------------------
After activating the virtual environment, to apply you changes, depending on them, may need to :
create migrations
.. code-block:: shell
python3 /var/www/pyscada/PyScadaServer/manage.py makemigrations
apply them
.. code-block:: shell
python3 /var/www/pyscada/PyScadaServer/manage.py migrate
copy static files (answer yes).
.. code-block:: shell
sudo -u pyscada -E env PATH=${PATH} python3 /var/www/pyscada/PyScadaServer/manage.py collectstatic
Then you can :
For urls, views or admin changes, restart gunicorn.
.. code-block:: shell
sudo systemctl restart gunicorn
Otherwise restart PyScada.
.. code-block:: shell
sudo systemctl restart pyscada
Override routes
----------------
This use case is encountered when you wish to rewrite an existing view (and therefore an existing route).
The PyScada project's ``urls.py`` file is used to load the software's routes (see `here `_).
* python virtual environment installation: located in ``/var/www/pyscada/PyScadaServer/PyScadaServer``
* Docker installation: located in ``/src/pyscada/PyScadaServer/PyScadaServer``
By default, the project's ``urls.py`` file loads only the ``urls.py`` file from ``pyscada.core``. The ``pyscada.core.urls`` file loads all the other modules ``urls.py`` files in random order.
The route used is the first valid one encountered, so if you want to replace an existing route, you have to load your route before the others, i.e. before loading ``pyscada.core.urls`` file.
To do this, you need to modify your project's ``urls.py`` file.
For a non-docker installation :
.. code-block:: shell
sudo -u pyscada nano /var/www/pyscada/PyScadaServer/PyScadaServer/urls.py
And include your route before pyscada.core.urls
.. code-block:: shell
urlpatterns = [
path('', include('pyscada.yourPlugin.urls')), #Routing file yourPlugin
path('', include('pyscada.core.urls')),
]
================================================
FILE: docs/device_protocol.rst
================================================
Device Protocol IDs
--------------------
- 1: Reserved (Scheduler)
- 2: `SystemStat `_
- 3: `Modbus `_
- 4: `BACNet `_
- 5: `VISA `_
- 6: `1-Wire `_
- 7: `Phant `_
- 8: `SMBus `_
- 9: Reserved (Jofra350)
- 10: `GPIO `_
- 11: `Reserved (PT104) `_
- 12: `OPC-UA `_
- 13: `SML (Smart Meter Language) `_
- 14: `File `_
- 15: `MeterBus (MBus) `_
- 16: Generic dummy device
- 17: `EMS `_
- 18: `Operations `_
- 19: `Aggregation `_
- 20: `MQTT `_
- 21: `Influxdb-Datasource `_
- 8X: Custom Worker
- 93 `Reserved (Serial) `_
- 94 `Reserved (WebService) `_
- 95: `Reserved (Scripting) `_
- 96: Reserved (Event)
- 97: Reserved (Mail)
- 98: Reserved (Report)
- 99: reserved (Export)
- 100+: reserved for dynamic
================================================
FILE: docs/django_settings.rst
================================================
Django Settings
===============
urls.py
-------
Open the urls configuration file and add the necessary rewrite rule to the django URL dispatcher.
::
nano /var/www/pyscada/PyScadaServer/PyScadaServer/urls.py
::
...
from django.conf.urls import url, include
from django.contrib import admin
urlpatterns = [
url(r'^admin/', admin.site.urls),
url(r'^', include('pyscada.core.urls')),
]
...
settings.py
-----------
Open the django settings file and make the following modifications. See also the `django documentation `_ for more Information.
::
nano /var/www/pyscada/PyScadaServer/PyScadaServer/settings.py
First deactivate the debugging, if debugging is active django will keep all SQL queries in the ram, the data-acquisition
runs a massive amount of queries so your system will run fast out of memory. Keep in mind to restart gunicorn and the
pysada daemons after you change the debugging state.
::
DEBUG = False
Add the host/domain of your machine, in this case every url that point to a ip of the machine is allowed.
::
ALLOWED_HOSTS = ['*']
Add PyScada and the PyScada sub-apps to the installed apps list of Django.
::
INSTALLED_APPS = [
...
'pyscada',
'pyscada.modbus',
'pyscada.phant',
'pyscada.visa',
'pyscada.hmi',
'pyscada.systemstat',
'pyscada.export',
'pyscada.onewire',
'pyscada.smbus',
]
To use the MySQL Database, fill in the database, the user and password as selected in the *create Database section*.
::
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'PyScada_db',
'USER': 'PyScada-user',
'PASSWORD': 'PyScada-user-password',
'OPTIONS': {
'init_command': "SET sql_mode='STRICT_TRANS_TABLES'",
}
}
}
Set the static file and media dir as follows.
::
...
STATIC_URL = '/static/'
STATIC_ROOT = '/var/www/pyscada/http/static/'
MEDIA_URL = '/media/'
MEDIA_ROOT = '/var/www/pyscada/http/media/'
Add all PyScada specific settings, keep in mind to set the file right file encoding in the `settings.py` file header (see also https://www.python.org/dev/peps/pep-0263/).
::
#!/usr/bin/python
# -*- coding: -*-
Append to the end of the `settings.py`:
::
# PyScada settings
# https://github.com/trombastic/PyScada
# email settings
DEFAULT_FROM_EMAIL = 'example@host.com'
EMAIL_HOST = 'mail.host.com'
EMAIL_PORT = 587
EMAIL_HOST_USER = 'pyscada@host.com'
EMAIL_USE_TLS = True
EMAIL_USE_SSL = False
EMAIL_HOST_PASSWORD = 'password'
EMAIL_PREFIX = 'PREFIX' # Mail subject will be "PREFIX subjecttext"
# meta information's about the plant site
PYSCADA_META = {
'name':'A SHORT NAME',
'description':'A SHORT DESCRIPTION',
}
# export properties
#
PYSCADA_EXPORT = {
'file_prefix':'PREFIX_',
'output_folder':'~/measurement_data_dumps',
}
# View Options
#
LINK_TARGET = '_blank' # '_blank' for new tab or '_self' for opening it in the same window
LOGGING = {
'version': 1,
'disable_existing_loggers': False,
'formatters': {
'standard': {
'format' : "[%(asctime)s] %(levelname)s [%(name)s:%(lineno)s] %(message)s",
'datefmt' : "%d/%b/%Y %H:%M:%S"
},
},
'handlers': {
'file': {
'level': 'DEBUG',
'class': 'logging.FileHandler',
'filename': BASE_DIR + '/pyscada_debug.log',
'formatter': 'standard',
},
},
'loggers': {
'django': {
'handlers': ['file'],
'level': 'INFO',
'propagate': True,
},
'pyscada': {
'handlers': ['file'],
'level': 'DEBUG',
'propagate': True,
},
},
}
================================================
FILE: docs/docker.rst
================================================
.. IMPORTANT::
This Version of PyScada is BETA software and may have serious bugs which may cause damage to your computer,
automation hardware and data. It is not intended for use in production systems! You use this Software on your own risk!
Docker
======
This guide covers the basic setup of PyScada with `Docker `_ and `Docker Compose `_.
Download the necessary files
----------------------------
First of all download the docker config files for building your images.
Using Git.
::
git clone https://github.com/pyscada/PyScada.git
cd PyScada/docker
Using wget.
::
wget -qO- -O tmp.zip https://github.com/pyscada/PyScada/archive/refs/heads/master.zip && unzip tmp.zip && rm tmp.zip
cd PyScada-master/docker
Generating SSL Certificates
---------------------------
Generate ssl certificates for using ssl.
::
mkdir nginx/ssl
cd nginx/ssl
openssl req -x509 -nodes -days 1780 -newkey rsa:2048 -keyout ./pyscada_server.key -out ./pyscada_server.crt
Build and Run the Image
-----------------------
Build the PyScada Docker Image.
::
sudo docker-compose build
After the Images have been successfully build we need to initialize the Database and Create a superuser.
::
sudo docker-compose run pyscada /src/pyscada/pyscada_init
sudo docker-compose run pyscada /src/pyscada/manage.py createsuperuser
The last step is to start the Container.
::
sudo docker-compose up -d
If you have an error or a command is stuck, run :
::
sudo docker-compose down
sudo docker system prune --force --volumes
================================================
FILE: docs/frontend.rst
================================================
Using the Front-End
===================
The ``settings.py`` file is usually located in ``/var/www/pyscada/PyScadaServer/PyScadaServer/``.
The home page can be defined to be a specific view in the ``settings.py`` file using:
.. code-block::
PYSCADA_HOME = "/view/TEST/"
Allowing anonymous access permission is defined in the ``settings.py`` file using:
.. code-block::
PYSCADA_ALLOW_ANONYMOUS = True
PYSCADA_ALLOW_ANONYMOUS_WRITE = True
================================================
FILE: docs/grafana.rst
================================================
Use Grafana
===========
Mysql
-----
Add user and give SELECT rights :
.. code-block:: shell
sudo mysql -uroot -p -e "GRANT SELECT ON PyScada_db.* TO 'Grafana-user'@'localhost' IDENTIFIED BY 'Grafana-user-password';"
Nginx
-----
Add in `/etc/nginx/nginx.conf` after ``http { ... }`` :
::
include /etc/nginx/grafana-access.conf;
Create `/etc/nginx/grafana-access.conf` with :
::
stream {
# MySQL server
server {
listen 3305;
proxy_pass 127.0.0.1:3306;
proxy_timeout 60s;
proxy_connect_timeout 30s;
}
}
Restart Nginx :
.. code-block:: shell
sudo systemctl restart nginx
Grafana
-------
Add MySQL datasource :
- Host :
- Local : `/run/mysqld/mysqld.sock`
- Remote : SERVER_WITH_NGINX_IP:3305
- Database : ``PyScada_db``
- User : ``Grafana-user``
- Password : ``Grafana-user-password``
Create a dashboard:
- Or import the `example dashboard `_.
- Or for example, add theses variables : set ``refresh on dashboard load``, ``multi-value`` and ``all option`` :
- Add mysql datasource variable (type Datasource).
- Add variables with type query using ``$Datasource`` :
- Protocols : ``SELECT protocol AS __text, id AS __value FROM pyscada_deviceprotocol``
- Devices : ``SELECT d.short_name AS __text, d.id AS __value FROM pyscada_device d WHERE d.protocol_id IN (${Protocols}) AND d.active = 1``
- Units : ``SELECT u.unit AS __text, u.id AS __value FROM pyscada_unit u``
- Variables : ``SELECT v.name AS __text, v.id AS __value FROM pyscada_variable v WHERE v.device_id IN (${Devices}) AND v.unit_id IN (${Units}) AND v.active = 1``
- Time group (type Interval) : ``1s,10s,1m,10m,30m,1h,6h,12h,1d,7d,14d,30d,1M``
- Null as (type custom) : ``0, NULL, previous``
- Example query :
.. code-block::
SELECT
$__timeGroupAlias(r.date_saved,$time_group),
avg(IFNULL(r.value_float64, 0.0) + IFNULL(r.value_int64, 0.0) + IFNULL(r.value_int32, 0.0) + IFNULL(r.value_int16, 0.0) + IFNULL(r.value_boolean, 0.0)),
v.name AS metric
FROM pyscada_recordeddata as r
JOIN pyscada_variable v ON r.variable_id = v.id
WHERE
$__timeFilter(r.date_saved) AND
r.variable_id IN (${Variables})
GROUP BY time, metric
ORDER BY $__timeGroup(r.date_saved,$time_group,$null_as)
Embed in pyscada HMI
--------------------
Edit Grafana config file:
.. code-block:: shell
sudo nano /etc/grafana/grafana.ini
Find and set :
- allow_embedding = true
- For localhost grafana : root_url = http://localhost:3000/grafana/
For localhost grafana add in `/etc/nginx/sites-enabled/pyscada.conf` :
::
location /grafana/ {
proxy_pass http://127.0.0.1:3000/;
}
Restart Grafana server:
.. code-block:: shell
sudo systemctl restart grafana-server.service
Create a custom html panel with the code from a dashboard or a panel from sharing options in grafana
Other
-----
use ssl : http://www.turbogeek.co.uk/2020/09/30/grafana-how-to-configure-ssl-https-in-grafana/
================================================
FILE: docs/index.rst
================================================
.. PyScada documentation master file, created by
sphinx-quickstart on Mon May 27 13:14:28 2019.
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.
Welcome to PyScada's documentation!
===================================
A Open Source SCADA System with HTML5 HMI, build using the Django framework. If you like to setup your own _SCADA_ system head over to the :doc:`installation` section.
.. toctree::
:maxdepth: 2
:caption: Installation and Commandline
quick_install
plugin_install
update
command-line
frontend
backend
device_protocol
grafana
develop
Indices and tables
==================
* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`
================================================
FILE: docs/installation.rst
================================================
.. IMPORTANT::
This Version of PyScada is BETA software and may have serious bugs which may cause damage to your computer,
automation hardware and data. It is not intended for use in production systems! You use this Software on your own risk!
Installation
============
This installation guide covers the installation of PyScada for `Debian 10/11 `_ ,
`Raspberry Pi OS `_, `Fedora 22/23 `_ based Linux systems
using `MySQL `_ / `MariaDB `_ or `SQLite `_ as Database,
`Gunicorn `_ as WSGI HTTP Server and `nginx `_ as HTTP Server.
Automatic installation using a script
-------------------------------------
On the Raspberry Pi with internet connection run :
::
wget https://raw.githubusercontent.com/clavay/PyScada-Laborem/master/extras/install.sh -O install.sh
sudo chmod a+x install.sh
sudo ./install.sh
Dependencies
------------
.. js:autofunction:: toggle_timeline
:short-name:
.. autofunction:: pyscada.models.Device.__str__
Debian 9, Raspbian
^^^^^^^^^^^^^^^^^^
::
sudo -i
apt-get update
apt-get -y upgrade
# if you use MariaDB/MySQL as Database system (recommend)
apt-get -y install mariadb-server python3-mysqldb
apt-get install -y python3-pip libhdf5-103 libhdf5-dev python3-dev nginx
pip3 install gunicorn
pip3 install pyserial
pip3 install docutils
macOS
^^^^^
- `MySQL Server `
- HDF5 TODO
::
brew install python
export PATH=$PATH:/usr/local/mysql/bin
pip install MySQL-python
all
^^^^
::
sudo -i
pip3 install https://github.com/pyscada/PyScada/archive/master.zip
# for VISA Protocol
pip3 install pyvisa pyvisa-py
# for 1Wire Protocol
apt-get install owfs #
pip3 install pyownet
# for smbus Protocol, install libffi-dev first!
apt-get install libffi-dev
pip3 install smbus-cffi
Add a new system-user for Pyscada (optional, recommend)
-------------------------------------------------------
Add a dedicated user for the pyscada server instance and add a directory for `static`/`media` files.
Linux
^^^^^
::
sudo -i
useradd -r pyscada
mkdir -p /var/www/pyscada/http
chown -R pyscada:pyscada /var/www/pyscada
mkdir -p /home/pyscada
chown -R pyscada:pyscada /home/pyscada
macOS
^^^^^
::
sudo -i
dscl . -create /Users/pyscada IsHidden 1
dscl . -create /Users/pyscada NFSHomeDirectory /Users/pyscada
LastID=`dscl . -list /Users UniqueID | awk '{print $2}' | sort -n | tail -1`
NextID=$((LastID + 1))
dscl . create /Users/pyscada UniqueID $NextID
dscl . create /Users/pyscada PrimaryGroupID 20
mkdir -p /var/www/pyscada/http
chown -R pyscada:staff /var/www/pyscada/
Create a MySql Database
-----------------------
Create the Database and grand the nessesery permission. Replace `PyScada_db`, `PyScada-user` and `PyScada-user-password` as you like.
::
mysql -uroot -p -e "CREATE DATABASE PyScada_db CHARACTER SET utf8;GRANT ALL PRIVILEGES ON PyScada_db.* TO 'PyScada-user'@'localhost' IDENTIFIED BY 'PyScada-user-password';"
Create a new Django Project
---------------------------
::
# Linux/OSX
cd /var/www/pyscada/
sudo -u pyscada django-admin startproject PyScadaServer
see :doc:`django_settings` for all necessary adjustments to the django settings.py and urls.py.
Initialize Database And Copy Static Files
-----------------------------------------
::
cd /var/www/pyscada/PyScadaServer # linux
sudo -u pyscada python3 manage.py migrate
sudo -u pyscada python3 manage.py collectstatic
# load fixtures with default configuration for chart lin colors and units
sudo -u pyscada python3 manage.py loaddata color
sudo -u pyscada python3 manage.py loaddata units
# initialize the background service system of pyscada
sudo -u pyscada python3 manage.py pyscada_daemon init
Add a Admin User To Your Django Project
---------------------------------------
::
cd /var/www/pyscada/PyScadaServer
sudo -u pyscada python3 manage.py createsuperuser
Setup the Webserver (nginx, gunicorn)
-------------------------------------
::
# debian
sudo wget https://raw.githubusercontent.com/pyscada/PyScada/master/extras/nginx_sample.conf -O /etc/nginx/sites-available/pyscada.conf
# Fedora
sudo wget https://raw.githubusercontent.com/pyscada/PyScada/master/extras/nginx_sample.conf -O /etc/nginx/conf.d/pyscada.conf
after editing, enable the configuration and restart nginx, optionally remove the default configuration
to use ssl (https, recommend)
-----------------------------
generate ssl certificates.
::
# for Debian, Ubuntu, Raspian
sudo mkdir /etc/nginx/ssl
# the certificate will be valid for 5 Years,
sudo openssl req -x509 -nodes -days 1780 -newkey rsa:2048 -keyout /etc/nginx/ssl/pyscada_server.key -out /etc/nginx/ssl/pyscada_server.crt
::
# debian
sudo ln -s /etc/nginx/sites-available/pyscada.conf /etc/nginx/sites-enabled/
sudo rm /etc/nginx/sites-enabled/default
now it's time to [re]start nginx.
::
# systemd (Debian 8, Fedora, Ubuntu > XX.XX)
sudo systemctl enable nginx.service # enable autostart on boot
sudo systemctl restart nginx
# SysV-Init (Debian 7, Ubuntu <= XX.XX, [Debian 8])
sudo service nginx restart
for Fedora you have to allow nginx to serve the static and media folder.
::
sudo chcon -Rt httpd_sys_content_t /var/www/pyscada/http/
add gunicorn and pyscada unit files:
::
# systemd
sudo wget https://raw.githubusercontent.com/pyscada/PyScada/master/extras/service/systemd/gunicorn.socket -O /etc/systemd/system/gunicorn.socket
sudo wget https://raw.githubusercontent.com/pyscada/PyScada/master/extras/service/systemd/gunicorn.service -O /etc/systemd/system/gunicorn.service
sudo wget https://raw.githubusercontent.com/pyscada/PyScada/master/extras/service/systemd/pyscada_daemon.service -O /etc/systemd/system/pyscada.service
# in some installations gunicorn is not at /usr/local/bin/gunicorn but at /usr/bin/gunicorn
# in this case you have to change the pat in the file /etc/systemd/system/gunicorn.service accordingly
# enable the services for autostart
sudo systemctl enable gunicorn
sudo systemctl start gunicorn
sudo systemctl enable pyscada
Start PyScada
-------------
::
sudo systemctl start pyscada
================================================
FILE: docs/make.bat
================================================
@ECHO OFF
REM Command file for Sphinx documentation
if "%SPHINXBUILD%" == "" (
set SPHINXBUILD=sphinx-build
)
set BUILDDIR=_build
set ALLSPHINXOPTS=-d %BUILDDIR%/doctrees %SPHINXOPTS% .
set I18NSPHINXOPTS=%SPHINXOPTS% .
if NOT "%PAPER%" == "" (
set ALLSPHINXOPTS=-D latex_paper_size=%PAPER% %ALLSPHINXOPTS%
set I18NSPHINXOPTS=-D latex_paper_size=%PAPER% %I18NSPHINXOPTS%
)
if "%1" == "" goto help
if "%1" == "help" (
:help
echo.Please use `make ^` where ^ is one of
echo. html to make standalone HTML files
echo. dirhtml to make HTML files named index.html in directories
echo. singlehtml to make a single large HTML file
echo. pickle to make pickle files
echo. json to make JSON files
echo. htmlhelp to make HTML files and a HTML help project
echo. qthelp to make HTML files and a qthelp project
echo. devhelp to make HTML files and a Devhelp project
echo. epub to make an epub
echo. latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter
echo. text to make text files
echo. man to make manual pages
echo. texinfo to make Texinfo files
echo. gettext to make PO message catalogs
echo. changes to make an overview over all changed/added/deprecated items
echo. xml to make Docutils-native XML files
echo. pseudoxml to make pseudoxml-XML files for display purposes
echo. linkcheck to check all external links for integrity
echo. doctest to run all doctests embedded in the documentation if enabled
echo. coverage to run coverage check of the documentation if enabled
goto end
)
if "%1" == "clean" (
for /d %%i in (%BUILDDIR%\*) do rmdir /q /s %%i
del /q /s %BUILDDIR%\*
goto end
)
REM Check if sphinx-build is available and fallback to Python version if any
%SPHINXBUILD% 2> nul
if errorlevel 9009 goto sphinx_python
goto sphinx_ok
:sphinx_python
set SPHINXBUILD=python -m sphinx.__init__
%SPHINXBUILD% 2> nul
if errorlevel 9009 (
echo.
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
echo.installed, then set the SPHINXBUILD environment variable to point
echo.to the full path of the 'sphinx-build' executable. Alternatively you
echo.may add the Sphinx directory to PATH.
echo.
echo.If you don't have Sphinx installed, grab it from
echo.http://sphinx-doc.org/
exit /b 1
)
:sphinx_ok
if "%1" == "html" (
%SPHINXBUILD% -b html %ALLSPHINXOPTS% %BUILDDIR%/html
if errorlevel 1 exit /b 1
echo.
echo.Build finished. The HTML pages are in %BUILDDIR%/html.
goto end
)
if "%1" == "dirhtml" (
%SPHINXBUILD% -b dirhtml %ALLSPHINXOPTS% %BUILDDIR%/dirhtml
if errorlevel 1 exit /b 1
echo.
echo.Build finished. The HTML pages are in %BUILDDIR%/dirhtml.
goto end
)
if "%1" == "singlehtml" (
%SPHINXBUILD% -b singlehtml %ALLSPHINXOPTS% %BUILDDIR%/singlehtml
if errorlevel 1 exit /b 1
echo.
echo.Build finished. The HTML pages are in %BUILDDIR%/singlehtml.
goto end
)
if "%1" == "pickle" (
%SPHINXBUILD% -b pickle %ALLSPHINXOPTS% %BUILDDIR%/pickle
if errorlevel 1 exit /b 1
echo.
echo.Build finished; now you can process the pickle files.
goto end
)
if "%1" == "json" (
%SPHINXBUILD% -b json %ALLSPHINXOPTS% %BUILDDIR%/json
if errorlevel 1 exit /b 1
echo.
echo.Build finished; now you can process the JSON files.
goto end
)
if "%1" == "htmlhelp" (
%SPHINXBUILD% -b htmlhelp %ALLSPHINXOPTS% %BUILDDIR%/htmlhelp
if errorlevel 1 exit /b 1
echo.
echo.Build finished; now you can run HTML Help Workshop with the ^
.hhp project file in %BUILDDIR%/htmlhelp.
goto end
)
if "%1" == "qthelp" (
%SPHINXBUILD% -b qthelp %ALLSPHINXOPTS% %BUILDDIR%/qthelp
if errorlevel 1 exit /b 1
echo.
echo.Build finished; now you can run "qcollectiongenerator" with the ^
.qhcp project file in %BUILDDIR%/qthelp, like this:
echo.^> qcollectiongenerator %BUILDDIR%\qthelp\PyScada.qhcp
echo.To view the help file:
echo.^> assistant -collectionFile %BUILDDIR%\qthelp\PyScada.ghc
goto end
)
if "%1" == "devhelp" (
%SPHINXBUILD% -b devhelp %ALLSPHINXOPTS% %BUILDDIR%/devhelp
if errorlevel 1 exit /b 1
echo.
echo.Build finished.
goto end
)
if "%1" == "epub" (
%SPHINXBUILD% -b epub %ALLSPHINXOPTS% %BUILDDIR%/epub
if errorlevel 1 exit /b 1
echo.
echo.Build finished. The epub file is in %BUILDDIR%/epub.
goto end
)
if "%1" == "latex" (
%SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex
if errorlevel 1 exit /b 1
echo.
echo.Build finished; the LaTeX files are in %BUILDDIR%/latex.
goto end
)
if "%1" == "latexpdf" (
%SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex
cd %BUILDDIR%/latex
make all-pdf
cd %~dp0
echo.
echo.Build finished; the PDF files are in %BUILDDIR%/latex.
goto end
)
if "%1" == "latexpdfja" (
%SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex
cd %BUILDDIR%/latex
make all-pdf-ja
cd %~dp0
echo.
echo.Build finished; the PDF files are in %BUILDDIR%/latex.
goto end
)
if "%1" == "text" (
%SPHINXBUILD% -b text %ALLSPHINXOPTS% %BUILDDIR%/text
if errorlevel 1 exit /b 1
echo.
echo.Build finished. The text files are in %BUILDDIR%/text.
goto end
)
if "%1" == "man" (
%SPHINXBUILD% -b man %ALLSPHINXOPTS% %BUILDDIR%/man
if errorlevel 1 exit /b 1
echo.
echo.Build finished. The manual pages are in %BUILDDIR%/man.
goto end
)
if "%1" == "texinfo" (
%SPHINXBUILD% -b texinfo %ALLSPHINXOPTS% %BUILDDIR%/texinfo
if errorlevel 1 exit /b 1
echo.
echo.Build finished. The Texinfo files are in %BUILDDIR%/texinfo.
goto end
)
if "%1" == "gettext" (
%SPHINXBUILD% -b gettext %I18NSPHINXOPTS% %BUILDDIR%/locale
if errorlevel 1 exit /b 1
echo.
echo.Build finished. The message catalogs are in %BUILDDIR%/locale.
goto end
)
if "%1" == "changes" (
%SPHINXBUILD% -b changes %ALLSPHINXOPTS% %BUILDDIR%/changes
if errorlevel 1 exit /b 1
echo.
echo.The overview file is in %BUILDDIR%/changes.
goto end
)
if "%1" == "linkcheck" (
%SPHINXBUILD% -b linkcheck %ALLSPHINXOPTS% %BUILDDIR%/linkcheck
if errorlevel 1 exit /b 1
echo.
echo.Link check complete; look for any errors in the above output ^
or in %BUILDDIR%/linkcheck/output.txt.
goto end
)
if "%1" == "doctest" (
%SPHINXBUILD% -b doctest %ALLSPHINXOPTS% %BUILDDIR%/doctest
if errorlevel 1 exit /b 1
echo.
echo.Testing of doctests in the sources finished, look at the ^
results in %BUILDDIR%/doctest/output.txt.
goto end
)
if "%1" == "coverage" (
%SPHINXBUILD% -b coverage %ALLSPHINXOPTS% %BUILDDIR%/coverage
if errorlevel 1 exit /b 1
echo.
echo.Testing of coverage in the sources finished, look at the ^
results in %BUILDDIR%/coverage/python.txt.
goto end
)
if "%1" == "xml" (
%SPHINXBUILD% -b xml %ALLSPHINXOPTS% %BUILDDIR%/xml
if errorlevel 1 exit /b 1
echo.
echo.Build finished. The XML files are in %BUILDDIR%/xml.
goto end
)
if "%1" == "pseudoxml" (
%SPHINXBUILD% -b pseudoxml %ALLSPHINXOPTS% %BUILDDIR%/pseudoxml
if errorlevel 1 exit /b 1
echo.
echo.Build finished. The pseudo-XML files are in %BUILDDIR%/pseudoxml.
goto end
)
:end
================================================
FILE: docs/nginx_setup.rst
================================================
Nginx Setup
===========
nginx configuration
-------------------
::
# debian
sudo wget https://raw.githubusercontent.com/trombastic/PyScada/dev/0.7.x/extras/nginx_sample.conf -O /etc/nginx/sites-available/pyscada.conf
sudo nano /etc/nginx/sites-available/pyscada.conf
# Fedora
sudo wget https://raw.githubusercontent.com/trombastic/PyScada/dev/0.7.x/extras/nginx_sample.conf -O /etc/nginx/conf.d/pyscada.conf
sudo nano /etc/nginx/conf.d/pyscada.conf
after editing, enable the configuration and restart nginx, optionaly remove the default configuration
::
# debian
sudo ln -s /etc/nginx/sites-available/pyscada.conf /etc/nginx/sites-enabled/
sudo rm /etc/nginx/sites-enabled/default
to use ssl
----------
generate ssl certificates.
::
# for Debian, Ubuntu, Raspian
sudo mkdir /etc/nginx/ssl
# the certificate will be valid for 5 Years,
sudo openssl req -x509 -nodes -days 1780 -newkey rsa:2048 -keyout /etc/nginx/ssl/pyscada_server.key -out /etc/nginx/ssl/pyscada_server.crt
now it's time to [re]start nginx.
::
# SysV-Init
sudo service nginx restart
# systemd
systemctl enable nginx.service # enable autostart on boot
sudo systemctl restart nginx
for Fedora you have to allow nginx to serve the static and media folder.
::
sudo chcon -Rt httpd_sys_content_t /var/www/pyscada/http/
================================================
FILE: docs/phant.rst
================================================
Phant Installation
==================
add the following line to the urls.py:
::
url(r'^', include('pyscada.phant.urls')),
================================================
FILE: docs/plugin_install.rst
================================================
PyScada plugin installation
===========================
1. Choose a method to download the PyScada plugin (exemple using PyScada-Modbus) :
- by cloning the repository :
.. code-block:: shell
sudo apt install git
cd /home/pyscada
sudo -u pyscada git clone https://github.com/pyscada/PyScada-Modbus.git
cd PyScada-Modbus
- by downloading the zip file and extracting it :
.. code-block:: shell
sudo apt install wget
cd /home/pyscada
sudo -u pyscada wget https://github.com/pyscada/PyScada-Modbus/archive/refs/heads/main.zip -O PyScada-Modbus-main.zip
sudo apt install unzip
sudo -u pyscada unzip ./PyScada-Modbus-main.zip
sudo -u pyscada rm ./PyScada-Modbus-main.zip
cd PyScada-Modbus-main
2. Install the PyScada plugin
Run :
.. code-block:: shell
# activate the PyScada virtual environment
source /home/pyscada/.venv/bin/activate
# install the plugin
sudo -u pyscada -E env PATH=${PATH} pip3 install .
# run migrations
sudo -u pyscada -E env PATH=${PATH} python3 /var/www/pyscada/PyScadaServer/manage.py migrate
# copy static files
sudo -u pyscada -E env PATH=${PATH} python3 /var/www/pyscada/PyScadaServer/manage.py collectstatic --no-input
# restart gunicorn and PyScada
sudo systemctl restart gunicorn pyscada
List PyScada plugin installed
-----------------------------
.. code-block:: shell
# activate the PyScada virtual environment
source /home/pyscada/.venv/bin/activate
pip3 list | grep cada
Uninstall a plugin
----------------------
To uninstall a plugin
.. code-block:: shell
sudo -u pyscada -E env PATH=${PATH} pip3 uninstall yourPlugin
================================================
FILE: docs/quick_install.rst
================================================
.. IMPORTANT::
This Version of PyScada is BETA software and may have serious bugs which may cause damage to your computer,
automation hardware and data. It is not intended for use in production systems! You use this Software on your own risk!
Installation
============
This installation guide covers the installation of PyScada for `Debian 10/11 `_ ,
`Raspberry Pi OS `_ based Linux systems
using `MariaDB `_ as Database,
`Gunicorn `_ as WSGI HTTP Server and `nginx `_ as HTTP Server.
Scripts available
-----------------
The script ``install.sh`` let you choose between 2 installation type : system or docker and create a log file of the installation.
Then it call the script ``install_system.sh`` or ``install_docker.sh`` depending on your choice.
Automatic installation on Debian and derivatives
------------------------------------------------
1. Choose a method to download PyScada (you need write rights in the current directory) :
- by cloning the repository :
.. code-block:: shell
sudo apt install git
git clone https://github.com/pyscada/PyScada.git
cd PyScada
- by downloading the zip file and extracting it :
.. code-block:: shell
sudo apt install wget
wget https://github.com/pyscada/PyScada/archive/refs/heads/main.zip -O PyScada-main.zip
sudo apt install unzip
unzip ./PyScada-main.zip
rm ./PyScada-main.zip
cd PyScada-main
2. Install PyScada
.. IMPORTANT::
For a new installation, make sure to answer "no" to the question "Update only".
You will have to choose :
* if you want to install PyScada on the system or in a docker container.
* if the system date is correct (system install only)
* if you want to use a proxy (system install only)
* if you want to install channels and redis to speed up communications inter pyscada processes (system install only)
* if you want to update only, if not :
* the DB name, user and password
* admin name and mail to send error logs (need further django email configuration in settings.py)
* the first pyscada user credentials
* if you want installed pyscada plugins to be automatically loaded
Run :
.. code-block:: shell
sudo ./install.sh
Troubleshooting
---------------
If you already installed PyScada using docker, you need to delete the ``db_data`` docker volume using :
.. code-block:: shell
docker volume rm docker_dbdata
================================================
FILE: docs/raspberryPiOS.rst
================================================
Raspberry Pi OS Installation
============================
Download last Lite image from `here `__
Copy the image on the SD card using (change the name of the zip file and the path to the sd card)::
unzip -p the_zip_file.zip | sudo dd of=/dev/sdX bs=4M conv=fsync status=progress
or
xz -dc the_xz_file.xz | sudo dd of=/dev/sdX bs=4M conv=fsync status=progress
More informations `here `__
================================================
FILE: docs/uninstall.rst
================================================
Installation
============
Depending on what you need on your computer, you may NOT need to remove everything PyScada requires (such as django, mariaDB...).
PyScada
-------
.. code-block:: shell
# activate the PyScada virtual environment
source /home/pyscada/.venv/bin/activate
# uninstall PyScada
sudo -u pyscada -E env PATH=${PATH} pip3 uninstall pyscada
# clean static files
python /var/www/pyscada/PyScadaServer/manage.py collectstatic --clear --no-input
# drop the mariaDB database, by default called PyScada_db
sudo mysql -u PyScada-user -p -e "DROP DATABASE IF EXISTS database_name PyScada_db;"
Uninstall prerequisites (IMPORTANT: only if not needed by other software !)
.. code-block:: shell
# Uninstall prerequisites
DEB_TO_UNINSTALL="
libatlas-base-dev
libffi-dev
libhdf5-103
libhdf5-dev
libjpeg-dev
libmariadb-dev
libopenjp2-7
mariadb-server
nginx
python3-dev
python3-mysqldb
python3-pip
python3-venv
zlib1g-dev
pkg-config
"
sudo apt remove -y $DEB_TO_UNINSTALL
PIP_TO_UNINSTALL="
cffi
Cython
docutils
gunicorn
lxml
mysqlclient
numpy
"
sudo -u pyscada -E env PATH=${PATH} pip3 uninstall $PIP_TO_UNINSTALL
PyScada plugin
--------------
.. code-block:: shell
# activate the PyScada virtual environment
source /home/pyscada/.venv/bin/activate
# uninstall PyScada-Plugin
sudo -u pyscada -E env PATH=${PATH} pip3 uninstall pyscada-plugin
# clean static files
python /var/www/pyscada/PyScadaServer/manage.py collectstatic --clear --no-input
python /var/www/pyscada/PyScadaServer/manage.py collectstatic --no-input
# clean db, may depend on the plugin
python /var/www/pyscada/PyScadaServer/manage.py migrate pyscada-plugin zero
Depending on the plugin, you may need to uninstall some packages.
================================================
FILE: docs/update.rst
================================================
Update from old versions
========================
0.6.x to 0.7.x
--------------
Sorry a direct upgrade is not possible, you have to install 0.7.x from scratch.
0.7.0b18 to 0.7.0b19
------------------------
::
cd /var/www/pyscada/PyScadaServer
sudo -u pyscada python manage.py migrate
sudo -u pyscada python manage.py collectstatic
sudo -u pyscada python manage.py pyscada_daemon init
0.8.x to 0.9x
-------------
Befor the Upgrade:
The folowing lines must be added to the `settings.py` after the `INSTALLED_APPS` section.
::
pyscada = __import__("pyscada.core")
if hasattr(pyscada.core, "additional_installed_app"):
for app in getattr(pyscada.core, "additional_installed_app"):
INSTALLED_APPS += [
app,
]
After the Upgrade:
- Remove `"pyscada.core"`, `"pyscada.hmi"`, `"pyscada.export"` from `INSTALLED_APPS` in `settings.py`
- (optinal) choose a alternative home page by adding `PYSCADA_HOME = "/view/TEST/"` to the `settings.py`
- (optinal) add `PYSCADA_ALLOW_ANONYMOUS = True` to allow access to the pyscada hmi without login or add `PYSCADA_ALLOW_ANONYMOUS_WRITE = True` to allow write access to the pyscada hmi without login
- Managing anonymous user display permission for IHM objects (view, page, widget, chart...) is done in the admin panel using the "Group Display Permission" -> "Unauthenticated users" configuration
- Run the folowing command in your pyscada root (where `manage.py` is located) in the pyscada venv
::
sudo -u pyscada python manage.py migrate
sudo -u pyscada python manage.py collectstatic
sudo -u pyscada python manage.py pyscada_daemon init
systemd
-------
::
sudo wget https://raw.githubusercontent.com/pyscada/PyScada/master/extras/service/systemd/pyscada_daemon.service -O /etc/systemd/system/pyscada_daemon.service
sudo systemctl enable pyscada_daemon
sudo systemctl disable pyscada_daq
sudo systemctl disable pyscada_event
sudo systemctl disable pyscada_mail
sudo systemctl disable pyscada_export
sudo rm /lib/systemd/system/pyscada_daq.service
sudo rm /lib/systemd/system/pyscada_mail.service
sudo rm /lib/systemd/system/pyscada_export.service
sudo rm /lib/systemd/system/pyscada_event.service
sudo systemctl daemon-reload
================================================
FILE: docs/visa.rst
================================================
Discover VISA devices
=====================
To discover GPIB/USB(/LXI?) devices run:
::
sudo python3
import pyvisa
rm=pyvisa.ResourceManager('@py')
rm.list_resources() # example : ('ASRL/dev/ttyAMA0::INSTR', 'USB0::1689::1032::C023569::0::INSTR', 'USB0::1689::851::1525638::0::INSTR')
inst=rm.open_resource('USB0::1689::851::1525638::0::INSTR'')
inst.query('*IDN?') # example : 'TEKTRONIX,AFG1022,1525638,SCPI:99.0 FV:V1.1.2\n'
================================================
FILE: eslint.config.mjs
================================================
export default [
{
files: ["**/*.js"],
rules: {
"semi": "warn",
"no-unused-vars": "warn"
}
}
];
================================================
FILE: extras/0.7to0.8.sh
================================================
#!/bin/bash
# check if path is passed
if [ $# -eq 0 ]
then
manage_path="/var/www/pyscada/PyScadaServer"
if test -f "$manage_path/manage.py"; then
echo "$manage_path/manage.py found."
else
echo "File $manage_path/manage.py not found. Please specify the path of manage.py."
exit 1
fi
else
if test -f "$1/manage.py"; then
echo "$1/manage.py found."
manage_path=$1
else
echo "File $1/manage.py not found. Please specify the path of manage.py or let empty tu use the default value : /var/www/pyscada/PyScadaServer/manage.py"
exit 1
fi
fi
# get the pyscada protocols with at least one device
res=$(echo -e "from pyscada.models import DeviceProtocol
for dp in DeviceProtocol.objects.all():
if len(dp.device_set.all()) > 0:
print(dp)
" | python3 $manage_path/manage.py shell)
# check and install plugins
if [[ $res == *"modbus"* ]]; then
echo "Modbus It's there!"
pip3 install pyscada-modbus
fi
if [[ $res == *"phant"* ]]; then
echo "phant It's there!"
pip3 install pyscada-phant
fi
if [[ $res == *"systemstat"* ]]; then
echo "systemstat It's there!"
pip3 install pyscada-systemstat
fi
if [[ $res == *"visa"* ]]; then
echo "visa It's there!"
pip3 install pyscada-visa
fi
if [[ $res == *"smbus"* ]]; then
echo "smbus It's there!"
pip3 install pyscada-smbus
fi
if [[ $res == *"onewire"* ]]; then
echo "onewire It's there!"
pip3 install pyscada-onewire
fi
================================================
FILE: extras/Grafana-test-dashboard.json
================================================
{
"__inputs": [
{
"name": "DS_PYSCADA",
"label": "PyScada",
"description": "",
"type": "datasource",
"pluginId": "mysql",
"pluginName": "MySQL"
}
],
"__requires": [
{
"type": "grafana",
"id": "grafana",
"name": "Grafana",
"version": "8.2.5"
},
{
"type": "datasource",
"id": "mysql",
"name": "MySQL",
"version": "1.0.0"
},
{
"type": "panel",
"id": "text",
"name": "Text",
"version": ""
},
{
"type": "panel",
"id": "timeseries",
"name": "Time series",
"version": ""
}
],
"annotations": {
"list": [
{
"builtIn": 1,
"datasource": "-- Grafana --",
"enable": true,
"hide": true,
"iconColor": "rgba(0, 211, 255, 1)",
"limit": 100,
"name": "Annotations & Alerts",
"showIn": 0,
"target": {
"limit": 100,
"matchAny": false,
"tags": [],
"type": "dashboard"
},
"type": "dashboard"
}
]
},
"editable": true,
"fiscalYearStartMonth": 0,
"gnetId": null,
"graphTooltip": 0,
"id": null,
"iteration": 1637571827897,
"links": [],
"liveNow": false,
"panels": [
{
"datasource": "$Datasource",
"description": "",
"fieldConfig": {
"defaults": {
"color": {
"mode": "palette-classic"
},
"custom": {
"axisLabel": "",
"axisPlacement": "auto",
"barAlignment": 0,
"drawStyle": "line",
"fillOpacity": 10,
"gradientMode": "hue",
"hideFrom": {
"legend": false,
"tooltip": false,
"viz": false
},
"lineInterpolation": "smooth",
"lineStyle": {
"fill": "solid"
},
"lineWidth": 2,
"pointSize": 5,
"scaleDistribution": {
"type": "linear"
},
"showPoints": "never",
"spanNulls": false,
"stacking": {
"group": "A",
"mode": "normal"
},
"thresholdsStyle": {
"mode": "off"
}
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
}
]
},
"unit": "short"
},
"overrides": []
},
"gridPos": {
"h": 15,
"w": 24,
"x": 0,
"y": 0
},
"id": 13,
"options": {
"legend": {
"calcs": [
"last",
"mean",
"max"
],
"displayMode": "table",
"placement": "right"
},
"tooltip": {
"mode": "multi"
}
},
"pluginVersion": "8.0.3",
"targets": [
{
"format": "time_series",
"group": [],
"hide": false,
"metricColumn": "none",
"rawQuery": true,
"rawSql": "SELECT\n $__timeGroupAlias(r.date_saved,$time_group),\n avg(IFNULL(r.value_float64, 0.0) + IFNULL(r.value_int64, 0.0) + IFNULL(r.value_int32, 0.0) + IFNULL(r.value_int16, 0.0) + IFNULL(r.value_boolean, 0.0)),\n v.name AS metric\nFROM pyscada_recordeddata as r \nJOIN pyscada_variable v ON r.variable_id = v.id\nWHERE\n $__timeFilter(r.date_saved) AND\n r.variable_id IN (${Variables})\nGROUP BY time, metric\nORDER BY $__timeGroup(r.date_saved,$time_group,$null_as)",
"refId": "B",
"select": [
[
{
"params": [
"id"
],
"type": "column"
}
]
],
"table": "pyscada_device",
"timeColumn": "connection_time",
"timeColumnType": "timestamp",
"where": []
}
],
"timeFrom": null,
"timeShift": null,
"title": "Test group by time",
"transformations": [],
"type": "timeseries"
},
{
"collapsed": false,
"datasource": null,
"gridPos": {
"h": 1,
"w": 24,
"x": 0,
"y": 15
},
"id": 8,
"panels": [],
"title": "Row title",
"type": "row"
},
{
"datasource": "${DS_PYSCADA}",
"gridPos": {
"h": 9,
"w": 24,
"x": 0,
"y": 16
},
"id": 2,
"options": {
"content": "# Title\n\nFor markdown syntax help: [commonmark.org/help](https://commonmark.org/help/)\n \nProtocoles : ${Protocols.text}\n\nIntruments : ${Devices}\n\nUnités : ${Units}\n\nVariables : ${Variables}\n\n",
"mode": "markdown"
},
"pluginVersion": "8.2.5",
"repeat": null,
"repeatDirection": "v",
"timeFrom": null,
"timeShift": null,
"title": "PyScada",
"transformations": [
{
"id": "seriesToColumns",
"options": {}
},
{
"id": "organize",
"options": {
"excludeByName": {
"Time": false,
"id": true
},
"indexByName": {},
"renameByName": {}
}
}
],
"type": "text"
}
],
"refresh": "",
"schemaVersion": 32,
"style": "dark",
"tags": [],
"templating": {
"list": [
{
"current": {
"selected": true,
"text": "PyScada",
"value": "PyScada"
},
"description": null,
"error": null,
"hide": 0,
"includeAll": false,
"label": null,
"multi": false,
"name": "Datasource",
"options": [],
"query": "mysql",
"queryValue": "",
"refresh": 1,
"regex": "",
"skipUrlSync": false,
"type": "datasource"
},
{
"allValue": null,
"current": {},
"datasource": "$Datasource",
"definition": "SELECT protocol AS __text, id AS __value FROM pyscada_deviceprotocol",
"description": null,
"error": null,
"hide": 0,
"includeAll": true,
"label": null,
"multi": true,
"name": "Protocols",
"options": [],
"query": "SELECT protocol AS __text, id AS __value FROM pyscada_deviceprotocol",
"refresh": 1,
"regex": "",
"skipUrlSync": false,
"sort": 0,
"tagValuesQuery": "",
"tagsQuery": "",
"type": "query",
"useTags": false
},
{
"allValue": null,
"current": {},
"datasource": "$Datasource",
"definition": "SELECT d.short_name AS __text, d.id AS __value FROM pyscada_device d WHERE d.protocol_id IN (${Protocols}) AND d.active = 1",
"description": null,
"error": null,
"hide": 0,
"includeAll": true,
"label": null,
"multi": true,
"name": "Devices",
"options": [],
"query": "SELECT d.short_name AS __text, d.id AS __value FROM pyscada_device d WHERE d.protocol_id IN (${Protocols}) AND d.active = 1",
"refresh": 1,
"regex": "",
"skipUrlSync": false,
"sort": 0,
"tagValuesQuery": "",
"tagsQuery": "",
"type": "query",
"useTags": false
},
{
"allValue": null,
"current": {},
"datasource": "$Datasource",
"definition": "SELECT u.unit AS __text, u.id AS __value FROM pyscada_unit u",
"description": null,
"error": null,
"hide": 0,
"includeAll": true,
"label": null,
"multi": true,
"name": "Units",
"options": [],
"query": "SELECT u.unit AS __text, u.id AS __value FROM pyscada_unit u",
"refresh": 1,
"regex": "",
"skipUrlSync": false,
"sort": 0,
"tagValuesQuery": "",
"tagsQuery": "",
"type": "query",
"useTags": false
},
{
"allValue": null,
"current": {},
"datasource": "$Datasource",
"definition": "SELECT v.name AS __text, v.id AS __value FROM pyscada_variable v WHERE v.device_id IN (${Devices}) AND v.unit_id IN (${Units}) AND v.active = 1",
"description": null,
"error": null,
"hide": 0,
"includeAll": true,
"label": null,
"multi": true,
"name": "Variables",
"options": [],
"query": "SELECT v.name AS __text, v.id AS __value FROM pyscada_variable v WHERE v.device_id IN (${Devices}) AND v.unit_id IN (${Units}) AND v.active = 1",
"refresh": 1,
"regex": "",
"skipUrlSync": false,
"sort": 0,
"tagValuesQuery": "",
"tagsQuery": "",
"type": "query",
"useTags": false
},
{
"auto": true,
"auto_count": 30,
"auto_min": "10s",
"current": {
"selected": true,
"text": "1m",
"value": "1m"
},
"description": null,
"error": null,
"hide": 0,
"label": "Time group",
"name": "time_group",
"options": [
{
"selected": false,
"text": "auto",
"value": "$__auto_interval_time_group"
},
{
"selected": false,
"text": "1s",
"value": "1s"
},
{
"selected": false,
"text": "10s",
"value": "10s"
},
{
"selected": true,
"text": "1m",
"value": "1m"
},
{
"selected": false,
"text": "10m",
"value": "10m"
},
{
"selected": false,
"text": "30m",
"value": "30m"
},
{
"selected": false,
"text": "1h",
"value": "1h"
},
{
"selected": false,
"text": "6h",
"value": "6h"
},
{
"selected": false,
"text": "12h",
"value": "12h"
},
{
"selected": false,
"text": "1d",
"value": "1d"
},
{
"selected": false,
"text": "7d",
"value": "7d"
},
{
"selected": false,
"text": "14d",
"value": "14d"
},
{
"selected": false,
"text": "30d",
"value": "30d"
},
{
"selected": false,
"text": "1M",
"value": "1M"
}
],
"query": "1s,10s,1m,10m,30m,1h,6h,12h,1d,7d,14d,30d,1M",
"queryValue": "",
"refresh": 2,
"skipUrlSync": false,
"type": "interval"
},
{
"allValue": null,
"current": {
"selected": true,
"text": "previous",
"value": "previous"
},
"description": null,
"error": null,
"hide": 0,
"includeAll": false,
"label": "Null as",
"multi": false,
"name": "null_as",
"options": [
{
"selected": false,
"text": "0",
"value": "0"
},
{
"selected": false,
"text": "NULL",
"value": "NULL"
},
{
"selected": true,
"text": "previous",
"value": "previous"
}
],
"query": "0, NULL, previous",
"queryValue": "",
"skipUrlSync": false,
"type": "custom"
}
]
},
"time": {
"from": "now-6h",
"to": "now"
},
"timepicker": {},
"timezone": "",
"title": "PyScada",
"uid": "bwhhV4pnz",
"version": 7
}
================================================
FILE: extras/nginx_sample.conf
================================================
# pyscada.conf
# the upstream component nginx needs to connect to
upstream app_server {
server unix:/tmp/gunicorn.sock fail_timeout=0; # for a file socket
#server 127.0.0.1:8000 fail_timeout=0; # for a file socket
}
# configuration of the server
server {
listen 80;
listen [::]:80;
server_name _; # substitute your machine's IP address or FQDN
#return 301 https://$server_name$request_uri;
return 301 https://$host$request_uri;
}
server {
listen 443 default_server ssl;
listen [::]:443 ssl;
server_name _; # substitute your machine's IP address or FQDN
charset utf-8;
keepalive_timeout 5;
client_max_body_size 75M; # max upload size, adjust to taste
# please comment if https is not used
ssl_certificate /etc/nginx/ssl/pyscada_server.crt; # The certificate file
ssl_certificate_key /etc/nginx/ssl/pyscada_server.key; # The private key file
# Django media
location /media {
alias /var/www/pyscada/http/media; # your Django project's media files - amend as required
}
location /static {
alias /var/www/pyscada/http/static; # your Django project's static files - amend as required
}
location /measurement {
alias /home/pyscada/measurement_data_dumps; # to support download of measurement files via admin backend - amend as required
}
location /favicon.ico {
proxy_pass http://127.0.0.1/static/pyscada/img/favicon.ico;
}
location / {
# checks for static file, if not found proxy to app
try_files $uri @proxy_to_app;
}
location @proxy_to_app {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_redirect off;
proxy_pass http://app_server;
}
}
================================================
FILE: extras/pyscada-logrotate
================================================
/var/log/pyscada_debug.log
{
rotate 4
weekly
missingok
notifempty
compress
delaycompress
size 1M
}
================================================
FILE: extras/service/SysV-init/gunicorn_django
================================================
#!/bin/bash
### BEGIN INIT INFO
# Provides: gunicorn_django
# Required-Start: $all
# Required-Stop: $all
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: starts the pyscada gunicorn server
# Description: starts pyscada gunicorn using start-stop-daemon
### END INIT INFO
# sample configfile for /etc/default/gunicorn_django
# APP_NAME='PyScadaServer'
# DJANGO_DIR='/var/www/pyscada/PyScadaServer'
# NUMBER_OF_WORKERS=10
# RUN_AS='pyscada'
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
PID_FILE=/tmp/gunicorn.pid
SOCKET_FILE=/tmp/gunicorn.sock
if [ -f /etc/default/gunicorn_django ] ; then
. /etc/default/gunicorn_django
else
# use default values
APP_NAME='PyScadaServer'
DJANGO_DIR=/var/www/pyscada/PyScadaServer/
NUMBER_OF_WORKERS=10
RUN_AS='pyscada'
fi
start () {
if [ -e $PID_FILE ]
then
PID=$(cat $PID_FILE)
if ps -p $PID > /dev/null
then
echo "gunicorn service is already running ($PID)"
exit 0
fi
fi
echo "Spawning $APP_NAME"
# Create the run directory if it doesn't exist
export DJANGO_SETTINGS_MODULE=$APP_NAME.settings
export PYTHONPATH=${data[1]}:$PYTHONPATH
# Start your Django Unicorn
# Programs meant to be run under supervisor should not daemonize themselves (do not use --daemon)
start-stop-daemon --start --quiet -c $RUN_AS -d $DJANGO_DIR --pidfile $PID_FILE --exec /usr/local/bin/gunicorn -- $APP_NAME.wsgi:application -n $APP_NAME -w $NUMBER_OF_WORKERS -u $RUN_AS -b unix:$SOCKET_FILE -p $PID_FILE -D
return
}
stop () {
if [ -e $PID_FILE ]
then
kill -TERM $(<"$PID_FILE")
echo "stopped service"
else
echo "service not running"
fi
}
case "$1" in
start)
echo "Starting"
start
;;
stop)
echo "Stopping"
stop
;;
restart)
echo "Restarting"
stop
sleep 1
start
;;
*)
N=/etc/init.d/$NAME
echo "Usage: $N {start|stop|restart} " >&2
exit 1
;;
esac
exit 0
================================================
FILE: extras/service/SysV-init/pyscada_daemon
================================================
#!/bin/bash
### BEGIN INIT INFO
# Provides: pyscada_daemon
# Required-Start: $all
# Required-Stop: $all
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: starts the pyscada daemon
# Description: starts pyscada daemon
### END INIT INFO
if [ -f /etc/default/pyscada_daemon ] ; then
. /etc/default/pyscada_daemon
else
# use default values
DJANGO_DIR=/var/www/pyscada/PyScadaServer/
RUN_AS='pyscada'
fi
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
start () {
echo "Spawning PyScada Daemon"
start-stop-daemon --start -c $RUN_AS -d $DJANGODIR --exec manage.py -- pyscada_daemon start
done
return
}
stop () {
echo "Stop PyScada Daemon"
start-stop-daemon --start -c $RUN_AS -d $DJANGODIR --exec manage.py -- pyscada_daemon stop
done
return
}
case "$1" in
start)
echo "Starting"
start
;;
stop)
echo "Stopping"
stop
;;
restart)
echo "Restarting"
stop
sleep 1
start
;;
*)
N=/etc/init.d/$NAME
echo "Usage: $N {start|stop|restart} " >&2
exit 1
;;
esac
exit 0
================================================
FILE: extras/service/systemd/gunicorn.service
================================================
[Unit]
Description=gunicorn daemon
Requires=gunicorn.socket
After=network.target
[Service]
PIDFile=/tmp/gunicorn.pid
User=pyscada
Group=pyscada
WorkingDirectory=/var/www/pyscada/PyScadaServer
#ExecStart=/usr/local/bin/gunicorn --pid /tmp/gunicorn.pid --workers 8 PyScadaServer.wsgi:application
ExecStart=/home/pyscada/.venv/bin/gunicorn --pid /tmp/gunicorn.pid --workers 8 PyScadaServer.wsgi:application
ExecReload=/bin/kill -s HUP $MAINPID
ExecStop=/bin/kill -s TERM $MAINPID
PrivateTmp=true
[Install]
WantedBy=multi-user.target
================================================
FILE: extras/service/systemd/gunicorn.socket
================================================
[Unit]
Description=gunicorn socket
[Socket]
ListenStream=/tmp/gunicorn.sock
ListenStream=0.0.0.0:9000
#ListenStream=[::]:8000
[Install]
WantedBy=sockets.target
================================================
FILE: extras/service/systemd/owfs.service
================================================
[Unit]
Description=OWFS Daemon
After=network.target
[Service]
Type=forking
PIDFile=/tmp/owfs_daemon.pid
#User=pyscada
#Group=pyscada
#WorkingDirectory=/var/www/pyscada/PyScadaServer/
ExecStart=/usr/bin/owfs -P /tmp/owfs_daemon.pid
#ExecStop=/usr/bin/python /var/www/pyscada/PyScadaServer/manage.py pyscada_daemon stop
Restart=always
RestartSec=60
[Install]
WantedBy=multi-user.target
================================================
FILE: extras/service/systemd/pyscada_daemon.service
================================================
[Unit]
Description=PyScada Daemon
After=network.target
After=mysql.service
After=redis-server.service
[Service]
Type=forking
PIDFile=/tmp/pyscada_daemon.pid
User=pyscada
Group=pyscada
WorkingDirectory=/var/www/pyscada/PyScadaServer/
#ExecStart=/usr/bin/python3 /var/www/pyscada/PyScadaServer/manage.py pyscada_daemon start
#ExecStop=/usr/bin/python3 /var/www/pyscada/PyScadaServer/manage.py pyscada_daemon stop
ExecStart=/home/pyscada/.venv/bin/python3 /var/www/pyscada/PyScadaServer/manage.py pyscada_daemon start
ExecStop=/home/pyscada/.venv/bin/python3 /var/www/pyscada/PyScadaServer/manage.py pyscada_daemon stop
Restart=always
RestartSec=60
[Install]
WantedBy=multi-user.target
================================================
FILE: extras/service/windows/register_windows_service.py
================================================
import win32serviceutil
import win32service
import win32event
import servicemanager
import os
class AppServerSvc(win32serviceutil.ServiceFramework):
_svc_name_ = "PyScada Daemon"
_svc_display_name_ = "PyScada Daemon"
_svc_description_ = "a PyScada Daemon for the detection"
def __init__(self, args):
win32serviceutil.ServiceFramework.__init__(self, args)
self.hWaitStop = win32event.CreateEvent(None, 0, 0, None)
def SvcStop(self):
self.ReportServiceStatus(win32service.SERVICE_STOP_PENDING)
win32event.SetEvent(self.hWaitStop)
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "PyScadaServer.settings")
import django
django.setup()
# todo implement
raise NotImplementedError
def SvcDoRun(self):
servicemanager.LogMsg(
servicemanager.EVENTLOG_INFORMATION_TYPE,
servicemanager.PYS_SERVICE_STARTED,
(self._svc_name_, ""),
)
self.main()
def main(self):
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "PyScadaServer.settings")
import django
django.setup()
# todo implement
raise NotImplementedError
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "PyScadaServer.settings")
win32serviceutil.HandleCommandLine(AppServerSvc)
================================================
FILE: extras/settings.py
================================================
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""
Django settings for PyScadaServer project.
Generated by 'django-admin startproject' using Django 2.2.9.
For more information on this file, see
https://docs.djangoproject.com/en/2.2/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/2.2/ref/settings/
Later customized for PyScada needs
"""
import os
import pyvisa
import importlib.util
import pkg_resources
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/2.2/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = ""
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = False
ALLOWED_HOSTS = ["*"]
# Application definition
INSTALLED_APPS = [
"django.contrib.admin",
"django.contrib.auth",
"django.contrib.contenttypes",
"django.contrib.sessions",
"django.contrib.messages",
"django.contrib.staticfiles",
"pyscada"
]
pyscada = __import__("pyscada.core")
if hasattr(pyscada.core, "additional_installed_app"):
for app in getattr(pyscada.core, "additional_installed_app"):
INSTALLED_APPS += [
app,
]
installed_packages = pkg_resources.working_set
for i in installed_packages:
if "pyscada-" in str(i):
lib = str(i).split(" ")[0].split("-")[1]
if importlib.util.find_spec("pyscada." + str(lib)) is not None:
INSTALLED_APPS += [
"pyscada." + str(lib),
]
if importlib.util.find_spec("channels") is not None:
INSTALLED_APPS += [
"channels",
]
CHANNEL_LAYERS = {
"default": {
"BACKEND": "channels_redis.core.RedisChannelLayer",
"CONFIG": {
"hosts": [("127.0.0.1", 6379)],
},
},
}
if util.find_spec('django_redis') is not None:
# for cache_datasource
CACHES = {
"default": {
"BACKEND": "django.core.cache.backends.redis.RedisCache",
"LOCATION": "redis://127.0.0.1:6379",
}
}
else:
# as fallback setup file based cache
CACHES = {
"default": {
"BACKEND": "django.core.cache.backends.filebased.FileBasedCache",
"LOCATION": "{{ project_root }}",
"TIMEOUT": 3600,
"OPTIONS": {"MAX_ENTRIES": 1000},
}
}
LOGIN_REDIRECT_URL = "/"
MIDDLEWARE = [
"django.middleware.security.SecurityMiddleware",
"django.contrib.sessions.middleware.SessionMiddleware",
"django.middleware.common.CommonMiddleware",
"django.middleware.csrf.CsrfViewMiddleware",
"django.contrib.auth.middleware.AuthenticationMiddleware",
"django.contrib.messages.middleware.MessageMiddleware",
"django.middleware.clickjacking.XFrameOptionsMiddleware",
]
AUTHENTICATION_BACKENDS = [
"django.contrib.auth.backends.ModelBackend",
]
if importlib.util.find_spec("django_cas_ng") is not None:
INSTALLED_APPS += [
"django_cas_ng",
]
AUTHENTICATION_BACKENDS += [
"django_cas_ng.backends.CASBackend",
]
CAS_SERVER_URL = "https://sso.univ-pau.fr/cas/"
CAS_VERSION = "2"
CAS_EXTRA_LOGIN_KWARGS = {
"proxies": {"https": "http://cache.iutbayonne.univ-pau.fr:3128"},
"timeout": 5,
}
LOGIN_URL = "/accounts/choose_login/"
ROOT_URLCONF = "PyScadaServer.urls"
TEMPLATES = [
{
"BACKEND": "django.template.backends.django.DjangoTemplates",
"DIRS": [],
"APP_DIRS": True,
"OPTIONS": {
"context_processors": [
"django.template.context_processors.debug",
"django.template.context_processors.request",
"django.contrib.auth.context_processors.auth",
"django.contrib.messages.context_processors.messages",
],
"libraries": {
"staticfiles": "django.templatetags.static",
},
},
},
]
WSGI_APPLICATION = "PyScadaServer.wsgi.application"
# Database
# https://docs.djangoproject.com/en/2.2/ref/settings/#databases
DATABASES = {
"default": {
"ENGINE": "django.db.backends.mysql",
"NAME": "PyScada_db",
"USER": "PyScada-user",
"PASSWORD": "PyScada-user-password",
"OPTIONS": {
"init_command": "SET sql_mode='STRICT_TRANS_TABLES'",
}
# 'ENGINE': 'django.db.backends.sqlite3',
# 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
}
}
# Password validation
# https://docs.djangoproject.com/en/2.2/ref/settings/#auth-password-validators
AUTH_PASSWORD_VALIDATORS = [
{
"NAME": "django.contrib.auth.password_validation.UserAttributeSimilarityValidator",
},
{
"NAME": "django.contrib.auth.password_validation.MinimumLengthValidator",
},
{
"NAME": "django.contrib.auth.password_validation.CommonPasswordValidator",
},
{
"NAME": "django.contrib.auth.password_validation.NumericPasswordValidator",
},
]
# Internationalization
# https://docs.djangoproject.com/en/2.2/topics/i18n/
LANGUAGE_CODE = "en-us"
TIME_ZONE = "UTC"
USE_I18N = True
USE_L10N = True
USE_TZ = True
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/2.2/howto/static-files/
STATIC_URL = "/static/"
STATIC_ROOT = "/var/www/pyscada/http/static/"
MEDIA_URL = "/media/"
MEDIA_ROOT = "/var/www/pyscada/http/media/"
# PyScada settings
# https://github.com/trombastic/PyScada
# email settings
DEFAULT_FROM_EMAIL = ""
EMAIL_HOST = ""
EMAIL_PORT = 465
EMAIL_HOST_USER = "r"
EMAIL_USE_TLS = False
EMAIL_USE_SSL = True
EMAIL_HOST_PASSWORD = ""
EMAIL_PREFIX = "PREFIX" # Mail subject will be "PREFIX subjecttext"
# meta information's about the plant site
PYSCADA_META = {
"name": "A SHORT NAME",
"description": "A SHORT DESCRIPTION",
}
# export properties
PYSCADA_EXPORT = {
"file_prefix": "PREFIX_",
"output_folder": "~/measurement_data_dumps",
}
LOGGING = {
"version": 1,
"disable_existing_loggers": False,
"formatters": {
"standard": {
"format": "[%(asctime)s] %(levelname)s [%(name)s:%(lineno)s] %(message)s",
"datefmt": "%d/%b/%Y %H:%M:%S",
},
},
"handlers": {
"file": {
"level": "DEBUG",
"class": "logging.FileHandler",
"filename": "/var/log/pyscada_debug.log",
"formatter": "standard",
},
},
"loggers": {
"": {
"handlers": ["file"],
"level": "ERROR",
"propagate": True,
},
"django": {
"handlers": ["file"],
"level": "INFO",
"propagate": False,
},
"pyscada": {
"handlers": ["file"],
"level": "DEBUG",
"propagate": False,
},
"gunicorn": {
"handlers": ["file"],
"level": "INFO",
"propagate": False,
},
},
}
VISA_DEVICE_SETTINGS = {
"USB0": {
"open_timeout": 5000,
"timeout": 15000,
},
"GPIB0": {
"open_timeout": 5000,
"timeout": 15000,
},
"ASRL/dev/ttyAMA0": {
"baud_rate": 9600,
"data_bits": 8,
"parity": pyvisa.constants.Parity.none,
"stop_bits": pyvisa.constants.StopBits.one,
"write_termination": "",
},
"ASRL/dev/ttyUSB0": {
"open_timeout": 5000,
},
}
================================================
FILE: extras/urls.py
================================================
"""PyScadaServer URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/1.11/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
Class-based views
1. Add an import: from other_app.views import Home
2. Add a URL to urlpatterns: url(r'^$', Home.as_view(), name='home')
Including another URLconf
1. Import the include() function: from django.conf.urls import url, include
2. Add a URL to urlpatterns: url(r'^blog/', include('blog.urls'))
"""
from django.urls import path, include
from django.contrib import admin
urlpatterns = [
path("", include("pyscada.hmi.urls")),
]
================================================
FILE: install.sh
================================================
#!/bin/bash
# check if the script is run from script directory
SOURCE=${BASH_SOURCE[0]}
while [ -L "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
DIR=$( cd -P "$( dirname "$SOURCE" )" >/dev/null 2>&1 && pwd )
SOURCE=$(readlink "$SOURCE")
[[ $SOURCE != /* ]] && SOURCE=$DIR/$SOURCE # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
done
DIR=$( cd -P "$( dirname "$SOURCE" )" >/dev/null 2>&1 && pwd )
if [[ "$DIR" != "$PWD" ]]; then
echo "You must run this script from $DIR"
exit 1
fi
# Make sure only root can run our script
if [[ $EUID -ne 0 ]]; then
echo "This script must be run as root" 1>&2
exit 1
fi
# Choose the config method (venv or docker)
answer_config=""
echo "choose your installation"
while [[ "$answer_config" == "" ]]; do
read -p "1: venv, 2: docker : " answer_config
case $answer_config in
"1")
#remove logs file if exist (to avoid appending)
if [ -f logs_install.txt ]; then
rm logs_install.txt
fi
#execute the install_venv.sh script and output error in logs file
source install_venv.sh 2>&1 | tee -a logs_install.txt 1>&2 | { while IFS= read -r line; do echo "$line"; done; }
;;
"2")
#remove logs file if exist (to avoid appending)
if [ -f logs_docker.txt ]; then
rm logs_docker.txt
fi
source install_docker.sh 2>&1 | tee -a logs_docker.txt 1>&2 | { while IFS= read -r line; do echo "$line"; done; }
;;
*)
echo "choose a valid configuration"
answer_config=""
;;
esac
#statements
done
================================================
FILE: install_docker.sh
================================================
#!/bin/bash
# VAR
answer_db_name="PyScada_db" # Name of the database
answer_db_user="PyScada-user" # Username for the database (not the root)
answer_db_password="PyScada-user-password" # Password for the database (not the root)
answer_auto_add_apps="True" # Auto add apps or manual add (in django configuration)
answer_admin_name="" # admin name (for the system)
answer_admin_mail="" # admin mail (for errors output)
ssl_dir="./nginx/ssl"
key_file="$ssl_dir/pyscada_server.key"
crt_file="$ssl_dir/pyscada_server.crt"
DOCKER_COMPOSE="./docker-compose.yml"
SETTINGS_TPL="../tests/project_template_tmp/project_name/settings.py-tpl"
DOCKERFILE_SQL="./mysql/Dockerfile"
# Make sure only root can run script
if [[ $EUID -ne 0 ]]; then
>&2 echo "This script must be run as root"
exit -1
fi
check_exit_status() {
local message=$1
local exit_status=$2
if [ $exit_status -ne 0 ]; then
>&2 echo "$message" # >&2: stderr output
exit -1
fi
wait
}
function debug(){
message=$1
echo ""
echo $message 1>&2
echo ""
}
function db_setup(){
debug "db_setup"
# copy clean docker-compose
cp ./docker-compose.yml-tmp $DOCKER_COMPOSE
check_exit_status "Unable to copy docker-compose.yml" $?
# copy template clean mysql Dockerfile
cp ./mysql/Dockerfile-tmp $DOCKERFILE_SQL
check_exit_status "Unable to copy Dockerfile" $?
# add mysql Dockerfile with db informations
sed -i "s|PyScada_db|$answer_db_name|g" $DOCKERFILE_SQL
sed -i "s|PyScada-user-password|$answer_db_password|g" $DOCKERFILE_SQL
sed -i "s|PyScada-user|$answer_db_user|g" $DOCKERFILE_SQL
# modify docker-compose.yml with db informations
sed -i "s|PyScada_db|$answer_db_name|g" $DOCKER_COMPOSE
sed -i "s|PyScada-user-password|$answer_db_password|g" $DOCKER_COMPOSE
sed -i "s|PyScada-user|$answer_db_user|g" $DOCKER_COMPOSE
debug "db_setup end"
}
# called in questions_clean_inst_setup
function regex_mail(){
debug "regex_mail"
regex='^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$';
while true; do
read -p "admin mail ? " answer_admin_mail
if [[ $answer_admin_mail =~ $regex ]]; then
break
else
echo "Choose a valid mail"
fi
done
debug "regex_mail end"
}
function questions_setup(){
debug "questions_setup"
admin_name_setup
regex_mail
project_admins=$(echo "('${answer_admin_name}', '${answer_admin_mail}' )")
echo $project_admins
echo $answer_db_name
# db params
read -p "Database name [PyScada_db]: " answer_db_name
read -p "Database user [PyScada-user]: " answer_db_user
read -sp "Database password (your input is hidden) [PyScada-user-password]: " answer_db_password
echo ""
if [[ "$answer_db_name" == "" ]]; then
answer_db_name="PyScada_db"
fi
if [[ "$answer_db_user" == "" ]]; then
answer_db_user="PyScada-user"
fi
if [[ "$answer_db_password" == "" ]]; then
answer_db_password="PyScada-user-password"
fi
while true; do
read -p "Auto add pyscada plugins ? [True/False]: " answer_auto_add_apps
if [[ "$answer_auto_add_apps" == "True" ]]; then
echo 'You need to restart pyscada and gunicorn after (un)installing any pyscada plugin.'
break;
elif [[ "$answer_auto_add_apps" == "False" ]]; then
echo 'You need manually add a plugin to the django project settings and restart pyscada and gunicorn after (un)installing any pyscada plugin.'
break;
else
echo "Please answer True or False."
fi
done
debug "questions_setup end"
}
# called in questions_clean_inst_setup
function admin_name_setup(){
debug "admin_name_setup"
while true; do
read -p "admin name ? " answer_admin_name
if [[ "$answer_admin_name" == "" ]]; then
echo "Choose a valid name"
else
break
fi
done
debug "admin_name_setup end"
}
function ssl_setup(){
# Creation of openssl certificate
debug "ssl_setup"
if [ ! -d "$ssl_dir" ]; then
mkdir "$ssl_dir"
check_exit_status "Unable to create ssl directory" $?
echo "SSL directory created"
else
echo "SSL directory already exist"
fi
if [ ! -f "$key_file" ] && [ ! -f "$crt_file" ]; then
rm -f "$ssl_dir/*"
openssl req -x509 -sha256 -nodes -days 365 -newkey rsa:2048 -keyout "$key_file" -out "$crt_file" -subj '/CN=www.mydom.com/O=My Company Name LTD./C=US'
check_exit_status "SSL certificates creation failed." $?
echo "SSL certificates created"
else
echo "SSL certificates already exist"
fi
debug "ssl_setup end"
}
function template_setup(){
# add db informations to django template
debug "template_setup"
rm -r ../tests/project_template_tmp/
cp -r ../tests/project_template ../tests/project_template_tmp
# add mysql host name to the mysql container
sed -i "/'PASSWORD': '/a \ \ \ \ \ \ \ \ 'HOST': 'db'," "$SETTINGS_TPL"
# remove concurrent_log_handler config and use file handler
sed -i "/ConcurrentRotatingFileHandler/c\ \ \ \ \ \ \ \ \ \ \ \ 'class': 'logging.FileHandler'," "$SETTINGS_TPL"
sed -i '/maxBytes/d' "$SETTINGS_TPL"
sed -i '/backupCount/d' "$SETTINGS_TPL"
check_exit_status "add mysql HOST failed" $?
# set up django settings file
sed -i "s|{{ db_name }}|$answer_db_name|g" $SETTINGS_TPL
sed -i "s|{{ db_user }}|$answer_db_user|g" $SETTINGS_TPL
sed -i "s|{{ db_password }}|$answer_db_password|g" $SETTINGS_TPL
sed -i "s|{{ project_root }}|\/src\/pyscada\/|g" $SETTINGS_TPL
sed -i "s|{{ log_file_dir }}|\/src\/pyscada\/|g" $SETTINGS_TPL
sed -i "s|{{ project_admins\|safe }}|$project_admins|g" $SETTINGS_TPL
sed -i "s|{{ auto_add_apps }}|$answer_auto_add_apps|g" $SETTINGS_TPL
sed -i "s|{{ additional_apps }}||g" $SETTINGS_TPL
sed -i "s|{{ additional_settings }}||g" $SETTINGS_TPL
rm ./pyscada/project_template.zip
cd ../tests/project_template_tmp
zip -r ../../docker/pyscada/project_template.zip .
check_exit_status "Unable to create project_template.zip" $?
cd ../../docker
rm ./pyscada/pyscada.zip
zip -r ./pyscada/pyscada.zip .. -x "../docs/*" "../.git/*" "../tests/*" "../docker/*" "../__pycache__/*"
debug "template_setup end"
}
# Verify if docker-compose is installed
if ! command -v docker-compose >/dev/null 2>&1; then
>&2 echo "Docker Compose is not installed."
exit -1
fi
systemctl is-active docker.service
check_exit_status "docker service is not running. Start it using : sudo systemctl start docker.service" $?
echo "The installation may take some time"
sleep 0
command -v zip >/dev/null 2>&1
check_exit_status "Zip is not installed, install it with : sudo apt install zip" $?
# Execute commands from ./docker
cd docker
check_exit_status "The docker directory is missing." $?
ssl_setup
wait
questions_setup
wait
db_setup
template_setup
wait
# Build the image with the --no-cache argument
docker-compose build --no-cache
check_exit_status "The image build failed." $?
# Execute pyscada init in the docker container
docker-compose run pyscada /src/pyscada/pyscada_init
check_exit_status "pyscada_init failed." $?
# Execute docker-compose up in the background
docker-compose up -d
sleep 10
# Execute into the container the superuseer creation
echo "Create admin account for the web interface : "
docker-compose run pyscada python3 /src/pyscada/manage.py createsuperuser
check_exit_status "Superuser creation failed." $?
# Verify if the containers are running
if docker ps | grep "pyscada" >/dev/null; then
echo "PyScada installed"
echo "Connect to http://127.0.0.1 using admin account created previously"
else
>&2 echo "docker-compose up failed."
exit -1
fi
================================================
FILE: install_venv.sh
================================================
#!/bin/bash
# todo : add inputs for django admin name, password
# check if the script is run from script directory
SOURCE=${BASH_SOURCE[0]}
while [ -L "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
DIR=$( cd -P "$( dirname "$SOURCE" )" >/dev/null 2>&1 && pwd )
SOURCE=$(readlink "$SOURCE")
[[ $SOURCE != /* ]] && SOURCE=$DIR/$SOURCE # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
done
DIR=$( cd -P "$( dirname "$SOURCE" )" >/dev/null 2>&1 && pwd )
if [[ "$DIR" != "$PWD" ]]; then
echo "You must run this script from $DIR"
exit 1
fi
# Make sure only root can run our script
if [[ $EUID -ne 0 ]]; then
echo "This script must be run as root"
exit 1
fi
# PATHS CONST
INSTALL_ROOT=/var/www/pyscada # files will be installed here
log_file_dir="/var/log/pyscada/" # log files will be here
SERVER_ROOT=$INSTALL_ROOT/PyScadaServer # django project root
pyscada_home=/home/pyscada
pyscada_venv=$pyscada_home/.venv
# VAR
answer_date="" # Is the date correct
answer_proxy="" # Setup of proxy
answer_config="" # Will it be install on docker or on venv
answer_db_name="" # Name of the database
answer_db_user="" # Username for the database (not the root)
answer_db_password="" # Password for the database (not the root)
answer_channels="" # Install or not channels and redis
answer_update="" # The installation is just an update or not
answer_auto_add_apps="" # Auto add apps or manual add (in django configuration)
answer_admin_name="" # admin name (for errors output)
answer_admin_mail="" # admin mail (for errors output)
answer_web_name="" # web interface admin name
answer_web_password="" # web interface admin password
echo -e "\nPyScada python packages will be installed in the virtual environment $pyscada_venv"
function debug(){
message=$1
echo ""
echo $message 1>&2
echo ""
}
# called in questions_setup
function regex_proxy(){
echo "regex_proxy" 1>&2
regex='^(https?|ftp)://[0-9a-zA-Z.-]+:[0-9]+$';
while true; do
read -p "Use proxy? [http://proxy:port or n]: " answer_proxy
if [[ $answer_proxy == "n" || $answer_proxy =~ $regex ]]; then
break
else
echo "Choose a valid proxy"
fi
done
echo "regex_proxy end" 1>&2
}
function pip3_proxy(){
if [[ "$answer_proxy" == "n" ]]; then
pip3 $*
else
echo "pip3 using" $answer_proxy "for" $* > /dev/tty
pip3 --proxy=$answer_proxy $*
fi
}
function pip3_proxy_not_rust(){
if [[ "$answer_proxy" == "n" ]]; then
CRYPTOGRAPHY_DONT_BUILD_RUST=1 pip3 install cryptography==3.4.6 --no-cache-dir
pip3 $*
else
echo "pip3 using" $answer_proxy "for" $* > /dev/tty
CRYPTOGRAPHY_DONT_BUILD_RUST=1 pip3 --proxy=$answer_proxy install cryptography==3.4.6 --no-cache-dir
pip3 --proxy=$answer_proxy $*
fi
}
function apt_proxy(){
if [[ "$answer_proxy" == "n" ]]; then
apt-get $*
else
echo "apt using" $answer_proxy "for" $* > /dev/tty
export http_proxy=$answer_proxy
apt-get $*
unset http_proxy
fi
}
# called in questions_clean_inst_setup
function regex_mail(){
debug "regex_mail"
regex='^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$';
while true; do
read -p "admin mail ? " answer_admin_mail
if [[ $answer_admin_mail =~ $regex ]]; then
break
else
echo "Choose a valid mail"
fi
done
debug "regex_mail end"
}
# called in questions_clean_inst_setup
function admin_name_setup(){
debug "admin_name_setup"
while true; do
read -p "admin name ? " answer_admin_name
if [[ "$answer_admin_name" == "" ]]; then
echo "Choose a valid name"
else
break
fi
done
debug "admin_name_setup end"
}
# called in questions_setup
function questions_clean_install_setup(){
debug "questions_clean_install_setup"
read -p "DB name ? [PyScada_db]: " answer_db_name
read -p "DB user ? [PyScada-user]: " answer_db_user
read -sp "DB password ? [PyScada-user-password]: " answer_db_password
echo ""
admin_name_setup
regex_mail
project_admins=$(echo "('${answer_admin_name}', '${answer_admin_mail}' )")
echo $project_admins
echo $answer_db_name
read -p "web interface admin name [pyscada]: " answer_web_name
read -p "web interface admin password [password]: " answer_web_password
if [[ "$answer_db_name" == "" ]]; then
answer_db_name="PyScada_db"
fi
if [[ "$answer_db_user" == "" ]]; then
answer_db_user="PyScada-user"
fi
if [[ "$answer_db_password" == "" ]]; then
answer_db_password="PyScada-user-password"
fi
if [[ "$answer_web_name" == "" ]]; then
answer_web_name="pyscada"
fi
if [[ "$answer_web_password" == "" ]]; then
answer_web_password="password"
fi
while true; do
read -p "Auto load pyscada plugins installed ? If False, you need to edit the settings.py file manually to load a plugin. [True/False]: " answer_auto_add_apps
if [[ "$answer_auto_add_apps" == "True" ]]; then
echo 'You need to restart pyscada and gunicorn after (un)installing any pyscada plugin.'
break;
elif [[ "$answer_auto_add_apps" == "False" ]]; then
echo 'You need manually add a plugin to the django project settings and restart pyscada and gunicorn after (un)installing any pyscada plugin.'
break;
else
echo "Please answer True or False."
fi
done
debug "questions_clean_install_setup end"
}
# called in the core of the script
function questions_setup(){
debug "questions_setup"
# Date verification
echo 'date :'
echo $(date)
read -p "Is the date and time correct ? [y/n]: " answer_date
if [[ "$answer_date" != "y" ]]; then
echo "please set the date correctly or enter 'y'"
exit 1
fi
# Proxy setup
regex_proxy
# Channels and redis
read -p "Install channels and redis to speed up inter pyscada process communications ? [y/n]: " answer_channels
# Clean installation or not
while true; do
read -p "Update only : if 'y' it will not create DB, superuser, copy services, settings and urls... On a fresh install you should answer 'n' ? [y/n]: " answer_update
if [[ "$answer_update" == "y" ]]; then
break
elif [[ "$answer_update" == "n" ]]; then
break
else
echo "Please answer y or n."
fi
done
if [[ "$answer_update" == "n" ]]; then
questions_clean_install_setup
fi
debug "questions_setup end"
}
# called in the core of the script
function install_dependences(){
debug "install_dependences"
apt_proxy install -y python3-pip
echo 'Some python3 packages installed:'
# Install prerequisites
DEB_TO_INSTALL="
libatlas-base-dev
libopenblas-dev
libffi-dev
libhdf5-dev
libjpeg-dev
libmariadb-dev
libopenjp2-7
mariadb-server
nginx
python3-dev
python3-mysqldb
python3-pip
python3-venv
zlib1g-dev
pkg-config
"
apt_proxy install -y $DEB_TO_INSTALL
# Create virtual environment
sudo -u pyscada python3 -m venv $pyscada_venv
# activate
source $pyscada_venv/bin/activate
PIP_TO_INSTALL="
cffi
Cython
docutils
gunicorn
lxml
mysqlclient
numpy
"
pip3_proxy install --upgrade $PIP_TO_INSTALL
debug "install_dependences end"
}
# called in pyscada_init
function web_setup(){
debug "web_setup"
(
cd $SERVER_ROOT
sudo -u pyscada -E env PATH=${PATH} python3 manage.py shell << EOF
try:
from django.contrib.auth import get_user_model
from django.db.utils import IntegrityError
User = get_user_model()
User.objects.create_superuser('$answer_web_name',
'team@pyscada.org',
'$answer_web_password')
except IntegrityError:
print('User pyscada already exist')
EOF
)
# Nginx
cp extras/nginx_sample.conf /etc/nginx/sites-available/pyscada.conf
ln -sf ../sites-available/pyscada.conf /etc/nginx/sites-enabled/
rm -f /etc/nginx/sites-enabled/default
mkdir -p /etc/nginx/ssl
# the certificate will be valid for 5 Years,
openssl req -x509 -nodes -days 1780 -newkey rsa:2048 -keyout /etc/nginx/ssl/pyscada_server.key -out /etc/nginx/ssl/pyscada_server.crt -subj '/CN=www.mydom.com/O=My Company Name LTD./C=US'
systemctl enable nginx.service # enable autostart on boot
systemctl restart nginx
# Gunicorn and PyScada as systemd units
cp extras/service/systemd/{gunicorn.{socket,service},pyscada_daemon.service} /etc/systemd/system
# Rename PyScada service file
mv /etc/systemd/system/pyscada_daemon.service /etc/systemd/system/pyscada.service
# Fix if gunicorn installed in /usr/bin and not /usr/local/bin -> create symbolic link
if [[ $(which gunicorn) != /usr/local/bin/gunicorn ]] && [[ ! -f /usr/local/bin/gunicorn ]] && [[ -f /usr/bin/gunicorn ]]; then
echo "Creating symcolic link to gunicorn" ;
ln -s /usr/bin/gunicorn /usr/local/bin/gunicorn;
fi
debug "web_setup end"
}
# called in the core of the script
function install_channel_redis(){
debug "install_channel_redis"
apt_proxy -y install redis-server
if grep -R "Raspberry Pi 3" "/proc/device-tree/model" ; then
echo "Don't install Rust for RPI3"
pip3_proxy_not_rust install --upgrade channels channels-redis asgiref
else
pip3_proxy install --upgrade cryptography==3.4.6 channels channels-redis asgiref
fi
debug "install_channel_redis end"
}
# called in the core of the script
function pyscada_init(){
debug "pyscada_init"
(
cd $SERVER_ROOT
# Migration and static files
sudo -u pyscada -E env PATH=${PATH} python3 manage.py migrate
sudo -u pyscada -E env PATH=${PATH} python3 manage.py collectstatic --noinput
# Load fixtures with default configuration for chart lin colors and units
sudo -u pyscada -E env PATH=${PATH} python3 manage.py loaddata color
sudo -u pyscada -E env PATH=${PATH} python3 manage.py loaddata units
# Initialize the background service system of pyscada
sudo -u pyscada -E env PATH=${PATH} python3 manage.py pyscada_daemon init
)
if [[ "$answer_update" == "n" ]]; then
web_setup
fi
# enable the services for autostart
systemctl enable gunicorn
systemctl restart gunicorn
systemctl enable pyscada
systemctl restart pyscada
sleep 1
systemctl --quiet is-active pyscada
if [ $? != 0 ] ; then
echo "Can't start pyscada systemd service." > /dev/stderr
exit 1
fi
if [[ "$answer_update" == "n" ]]; then
echo "PyScada installed"
echo "Connect to http://127.0.0.1 using :"
echo "username : $answer_web_name"
echo "password : $answer_web_password"
else
echo "PyScada updated"
fi
debug "pyscada_init end"
}
# called in the core of the script
function db_setup(){
debug "db_setup"
# Create DB
mysql << EOF
CREATE DATABASE IF NOT EXISTS ${answer_db_name}
CHARACTER SET utf8;
GRANT ALL PRIVILEGES ON ${answer_db_name}.*
TO '${answer_db_user}'@'localhost'
IDENTIFIED BY '${answer_db_password}';
EOF
debug "db_setup end"
}
#called in the core of the script
function template_setup(){
debug "template_setup"
# add db informations to django template
rm -r ./tests/project_template_tmp/
cp -r ./tests/project_template ./tests/project_template_tmp/
chmod a+w ./tests/project_template_tmp/project_name/settings.py-tpl
sudo -u pyscada -E env PATH=${PATH} python3 << EOF
import django
from django.conf import settings
from django.template.loader import render_to_string
settings.configure(
TEMPLATES=[{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': ['./'], # script dir
'OPTIONS': {'string_if_invalid': '{{ %s }}'}, # prevents the other template tags to be replaced by ''
}]
)
django.setup()
from django.template import Template, Context
with open("./tests/project_template_tmp/project_name/settings.py-tpl", "r+") as f:
template = Template(f.read())
context = Context({
"db_name": "${answer_db_name}",
"db_user": "${answer_db_user}",
"db_password": "${answer_db_password}",
"project_root": "${INSTALL_ROOT}",
"pyscada_home": "${pyscada_home}",
"log_file_dir": "${log_file_dir}",
"project_admins": "${project_admins}",
"auto_add_apps": "${answer_auto_add_apps}",
"additional_apps": "",
"additional_settings": "",
})
f.seek(0)
f.write(template.render(context))
f.truncate()
EOF
sudo -u pyscada mkdir -p $SERVER_ROOT
sudo -u pyscada -E env PATH=${PATH} django-admin startproject PyScadaServer $SERVER_ROOT --template ./tests/project_template_tmp
rm -rf ./tests/project_template_tmp
debug "template_setup end"
}
# called in the core of the script
function user_setup(){
debug "user_setup"
# Create pyscada user
echo "Creating system user pyscada..."
useradd -r pyscada
mkdir -p $pyscada_home
chown -R pyscada:pyscada $pyscada_home
mkdir -p $INSTALL_ROOT
chown -R pyscada:pyscada $INSTALL_ROOT
mkdir -p $pyscada_home/measurement_data_dumps
chown -R pyscada:pyscada $pyscada_home/measurement_data_dumps
mkdir ${log_file_dir}
chown pyscada:pyscada ${log_file_dir}
touch ${log_file_dir}pyscada_{daemon,debug}.log
chown pyscada:pyscada ${log_file_dir}pyscada_{daemon,debug}.log
# Add rights for usb, i2c and serial
adduser www-data pyscada
adduser pyscada dialout
debug "user_setup end"
}
# stop pyscada and show some python3 packages installed
function stop_pyscada(){
debug "stop_pyscada"
echo "Stopping PyScada"
systemctl stop pyscada gunicorn gunicorn.socket
sleep 1 # Give systemd time to shutdown
systemctl --quiet is-active pyscada
if [ $? == 0 ] ; then
echo "Can't stop pyscada systemd service. Aborting."
exit 1
fi
echo "PyScada stopped"
debug "stop_pyscada end"
}
# install process: * means depending on the user answer
: <<'END'
- questions_setup
- regex_proxy
- *questions_clean_install_setup
- admin_name_setup
- regex_mail
- stop_pyscada
- user_setup
- install_dependences
- apt_proxy
- pip3_proxy
- pyscada install
- *install_channel_redis
- apt_proxy
- pip3_proxy_not_rust
- pip3_proxy
- *db_setup
- *template_setup
- pyscada_init
- *web_setup
END
questions_setup
stop_pyscada
user_setup
install_dependences
# Install PyScada
pip3_proxy install --upgrade .
if [[ "$answer_channels" == "y" ]]; then
install_channel_redis
fi
if [[ "$answer_update" == "n" ]]; then
db_setup
template_setup
fi
pyscada_init
# fix owner in /home/pyscada
chown -R pyscada:pyscada $pyscada_home
================================================
FILE: move_data.py
================================================
# -*- coding: utf-8 -*-
"""
copies data from pyscada.models.RecordedDataOld to RecordedData
the script will terminate after 5 minutes, if you would like to copy more content change the timeout accordingly
"""
from __future__ import unicode_literals
import os
import gc
from datetime import datetime
from time import time
from pytz import UTC
import logging
logger = logging.getLogger("pyscada.core.move_data")
def queryset_iterator(queryset, chunk_size=100000):
counter = 0
count = chunk_size
while count == chunk_size:
offset = counter - counter % chunk_size
count = 0
for item in queryset.all()[offset : offset + chunk_size]:
count += 1
yield item
counter += count
gc.collect()
if __name__ == "__main__":
os.chdir("/var/www/pyscada/PyScadaServer")
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "PyScadaServer.settings")
import django
django.setup()
from pyscada.models import RecordedData, RecordedDataOld
min_pk = RecordedData.objects.first().pk
recoded_data_set = queryset_iterator(
RecordedDataOld.objects.filter(pk__lt=min_pk).order_by("-pk")
)
# recoded_data_set = queryset_iterator(RecordedDataOld.objects.all().order_by('-pk'))
# logger.info('%d'%min_pk)
# logger.info('%d'%RecordedDataOld.objects.filter(pk__lt=min_pk).count())
count = 0
count_all = 0
timeout = time() + 60 * 10 # <-- set the timeout in minutes
items = []
for item in recoded_data_set:
# if RecordedData.objects.filter(pk=item.id):
# continue
items.append(
RecordedData(
id=item.id,
variable_id=item.variable_id,
value_boolean=item.value_boolean,
value_int16=item.value_int16,
value_int32=item.value_int32,
value_int64=item.value_int64,
value_float64=item.value_float64,
date_saved=datetime.fromtimestamp(
(item.pk - item.variable.pk) / 2097152 / 1000.0, UTC
),
)
)
if time() > timeout:
break
count += 1
if count >= 10000:
RecordedData.objects.bulk_create(items)
items = []
count_all += count
count = 0
logger.info("wrote %d lines in total\n" % count_all)
if len(items) > 0:
RecordedData.objects.bulk_create(items)
count_all += len(items)
logger.info("wrote %d lines in total\n" % count_all)
================================================
FILE: pyproject.toml
================================================
[build-system]
requires = ["setuptools>=61.0.0,<69.3.0"]
build-backend = "setuptools.build_meta:__legacy__"
[project]
name = "PyScada"
dynamic = ["version"]
requires-python = ">= 3.10"
dependencies = [
"django>=5.2,<5.3",
"numpy>=1.6.0",
"h5py>=2.2.1",
"pillow",
"python-daemon>=2.0.0",
"pytz",
"python-dateutil",
# 'channels',
# 'channels-redis',
"asgiref",
"monthdelta",
"six",
"concurrent-log-handler", # rotating logs for multiprocess
"scipy",
]
authors = [
{name = "Martin Schröder", email = "team@pyscada.org"},
{name = "Camille Lavayssiere", email = "team@pyscada.org"}
]
description="A Python and Django based Open Source SCADA System"
readme = "README.rst"
license = {text = "AGPLv3"}
classifiers = [
"Development Status :: 4 - Beta",
"Environment :: Web Environment",
"Environment :: Console",
"Framework :: Django",
"Intended Audience :: Developers",
"Intended Audience :: Science/Research",
"License :: OSI Approved :: GNU Affero General Public License v3 or later (AGPLv3+)",
"Operating System :: POSIX",
"Operating System :: MacOS :: MacOS X",
"Programming Language :: Python",
"Programming Language :: JavaScript",
"Topic :: Internet :: WWW/HTTP :: Dynamic Content",
"Topic :: Scientific/Engineering :: Visualization",
]
[project.urls]
Homepage = "https://www.pyscada.org/"
Documentation = "https://pyscada.readthedocs.io"
Source = "https://github.com/pyscada/PyScada"
Tracker = "https://github.com/pyscada/PyScada/issues"
[tool.black]
target-version = ["py310"]
force-exclude = "tests/test_runner_apps/tagged/tests_syntax_error.py"
[tool.isort]
profile = "black"
default_section = "THIRDPARTY"
known_first_party = "pyscada"
[tool.setuptools.packages.find]
include = ["pyscada*"]
================================================
FILE: pyscada/__init__.py
================================================
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)
================================================
FILE: pyscada/admin.py
================================================
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from pyscada.models import Device, DeviceProtocol, DeviceHandler
from pyscada.models import Variable, VariableProperty, DataSource, DataSourceModel
from pyscada.models import Scaling, Color
from pyscada.models import Unit, Dictionary, DictionaryItem
from pyscada.models import DeviceWriteTask, DeviceReadTask
from pyscada.models import Log
from pyscada.models import BackgroundProcess
from pyscada.models import (
ComplexEvent,
ComplexEventLevel,
ComplexEventInput,
ComplexEventOutput,
)
from pyscada.models import Event
from pyscada.models import RecordedEvent
from pyscada.models import Mail
from pyscada.models import DeviceHandlerParameter, VariableHandlerParameter
from django.contrib import messages
from django.contrib import admin
from django import forms
from django.contrib.admin import AdminSite
from django.contrib.auth.models import User, Group
from django.contrib.auth.admin import UserAdmin, GroupAdmin
from django.utils.translation import gettext_lazy as _
from django.db.models.fields.related import OneToOneRel
from django.utils.html import mark_safe
from django.forms import BaseInlineFormSet
from django.core.exceptions import ValidationError
from django import forms
from django.db.utils import ProgrammingError, OperationalError
from django.conf import settings
import sys
import datetime
import signal
import logging
logger = logging.getLogger(__name__)
# Custom AdminSite
class PyScadaAdminSite(AdminSite):
site_header = "PyScada Administration"
def populate_inline(items, form_model=None, output=[], stacked=admin.StackedInline):
for item in items:
if form_model is None:
item_dict = dict(model=item.related_model)
else:
item_dict = dict(model=item.related_model, form=form_model)
if hasattr(item.related_model, "fk_name"):
item_dict["fk_name"] = item.related_model.fk_name
if hasattr(item.related_model, "FormSet"):
item_dict["formset"] = item.related_model.FormSet
if hasattr(item.related_model, "fieldsets"):
item_dict["fieldsets"] = item.related_model.fieldsets
if hasattr(item.related_model, "filter_horizontal"):
item_dict["filter_horizontal"] = item.related_model.filter_horizontal
if hasattr(item.related_model, "filter_vertical"):
item_dict["filter_vertical"] = item.related_model.filter_vertical
if hasattr(item.related_model, "Form"):
items_dict["form"] = item.related_model.Form
# if hasattr(item.related_model, "formfield_for_foreignkey"):
# item_dict["formfield_for_foreignkey"] = item.related_model.formfield_for_foreignkey
out = type(item.name, (stacked,), item_dict) # classes=['collapse']
output.append(out)
return output
## admin actions
def restart_process(_modeladmin, request, queryset):
"""
restarts a dedicated process
:return:
"""
for process in queryset:
process.restart()
restart_process.short_description = "Restart Processes"
def stop_process(_modeladmin, request, queryset):
"""
restarts a dedicated process
:return:
"""
for process in queryset:
process.stop()
stop_process.short_description = "Terminate Processes"
def kill_process(_modeladmin, request, queryset):
"""
restarts a dedicated process
:return:
"""
for process in queryset:
process.stop(signum=signal.SIGKILL)
kill_process.short_description = "Kill Processes"
def silent_delete(self, _request, queryset):
queryset.delete()
silent_delete.short_description = "Silent delete (lot of records)"
# Custom Filters
class BackgroundProcessFilter(admin.SimpleListFilter):
# Human-readable title which will be displayed in the
# right admin sidebar just above the filter options.
title = _("parent process filter")
# Parameter for the filter that will be used in the URL query.
parameter_name = "parent_process"
def lookups(self, request, model_admin):
"""
Returns a list of tuples. The first element in each
tuple is the coded value for the option that will
appear in the URL query. The second element is the
human-readable name for the option that will appear
in the right sidebar.
"""
qs = model_admin.get_queryset(request)
qs.filter(id__range=(1, 99))
for item in qs:
dp = DeviceProtocol.objects.filter(pk=item.id).first()
if dp:
yield (dp.pk, dp.app_name)
def queryset(self, request, queryset):
"""
Returns the filtered queryset based on the value
provided in the query string and retrievable via
`self.value()`.
"""
if self.value() is not None:
if int(self.value()) > 0:
return queryset.filter(parent_process_id=self.value())
# Admin models
class VariableInlineAdminFrom(forms.ModelForm):
def has_changed(self):
# Force save inline for the good protocol if selected device and protocol_id exists
if (
self.data.get("device", None) != ""
and self.data.get("device", None) is not None
):
d = Device.objects.get(id=int(self.data.get("device", None)))
if (
hasattr(self.instance, "protocol_id")
and d is not None
and d.protocol.id == self.instance.protocol_id
):
return True
return False
class VariableAdminFrom(forms.ModelForm):
def __init__(self, *args, **kwargs):
super(VariableAdminFrom, self).__init__(*args, **kwargs)
# disable delete button for datasource foreign key
if "datasource" in self.fields:
self.fields["datasource"].widget.can_delete_related = False
if isinstance(self.instance, Variable):
wtf = Color.objects.all()
if "chart_line_color" in self.fields:
w = self.fields["chart_line_color"].widget
color_choices = []
for choice in wtf:
color_choices.append((choice.id, choice.color_code()))
w.choices = color_choices
def create_option_color(
self, name, value, label, selected, index, subindex=None, attrs=None
):
font_color = hex(int("ffffff", 16) - int(label[1::], 16))[2::]
# attrs = self.build_attrs(attrs,{'style':'background: %s; color: #%s'%(label,font_color)})
self.option_inherits_attrs = True
return self._create_option(
name,
value,
label,
selected,
index,
subindex,
attrs={
"style": "background: %s; color: #%s" % (label, font_color)
},
)
import types
# from django.forms.widgets import Select
w.widget._create_option = w.widget.create_option # copy old method
w.widget.create_option = types.MethodType(
create_option_color, w.widget
) # replace old with new
w.widget.attrs = {
"onchange": "this.style.backgroundColor=this.options[this.selectedIndex].style."
"backgroundColor;this.style.color=this.options[this.selectedIndex].style.color"
}
class VariableState(Variable):
class Meta:
proxy = True
class VariableStateAdmin(admin.ModelAdmin):
list_display = ("name", "last_value")
list_filter = ("device__short_name", "active", "unit__unit", "value_class")
list_display_links = ()
list_per_page = 10
actions = [silent_delete]
search_fields = ("name",)
form = VariableAdminFrom
# Add inlines for any model with OneToOne relation with Device
related_variables = [
field
for field in Variable._meta.get_fields()
if issubclass(type(field), OneToOneRel)
]
inlines = populate_inline(
related_variables,
VariableInlineAdminFrom,
output=[],
stacked=admin.StackedInline,
)
class Media:
js = (
# To be sure the jquery files are loaded before our js file
"admin/js/vendor/jquery/jquery.min.js",
"admin/js/jquery.init.js",
"pyscada/js/admin/display_inline_protocols_variable.js",
)
def last_value(self, instance):
try:
v = Variable.objects.get(id=instance.pk)
if v.check_last_datapoint():
try:
return f"{datetime.datetime.fromtimestamp(v.timestamp_old).strftime('%Y-%m-%d %H:%M:%S')} : {v.prev_value.__str__()} {instance.unit.unit}"
except ValueError as e:
return f"ValueError {e} - with timestamp {v.timestamp_old} : {v.prev_value.__str__()} {instance.unit.unit}"
except Variable.DoesNotExist:
return "Variable does not exist"
except TimeoutError:
return "Timeout on value query"
return f" - : NaN {instance.unit.unit}"
class DeviceForm(forms.ModelForm):
def has_changed(self):
# Force save inline for the right protocol if parent_device() and protocol_id exists
if self.data.get("protocol", None) is not None:
if hasattr(self.instance, "protocol_id") and self.data.get(
"protocol", None
) == str(self.instance.protocol_id):
return True
else:
if (
hasattr(self.instance, "protocol_id")
and hasattr(self.instance, "parent_device")
and self.instance.parent_device() is not None
and self.instance.parent_device().protocol is not None
and self.instance.parent_device().protocol.id
== self.instance.protocol_id
):
return True
return super().has_changed()
class DeviceHandlerParameterInlineForm(forms.ModelForm):
class Meta:
model = DeviceHandlerParameter
fields = ("value",)
class DeviceHandlerParameterInlineFormSet(BaseInlineFormSet):
def clean(self):
super().clean()
raise_error = []
if self.instance.instrument_handler is not None:
parameters = self.instance.instrument_handler.get_device_parameters()
else:
parameters = {}
for parameter in parameters:
parameters[parameter]["found"] = False
result_forms = []
for form in self.forms:
if form.instance.name in parameters.keys():
if parameters[form.instance.name]["found"]:
# DeviceHandlerParameter already found, delete duplicate
form.instance.delete()
else:
parameters[form.instance.name]["found"] = True
if (
not parameters[form.instance.name].get("null", True)
and form.instance.value == ""
):
# value is needed
raise_error.append(form.instance.name)
result_forms.append(form)
else:
# DeviceHandlerParameter not needed
try:
form.instance.delete()
except ValueError:
pass
self.forms = result_forms
# TODO : redirect to a specific page if parameters was missing on the add/change page, in order to create these parameters
if len(raise_error):
raise ValidationError(
f"Value is required for parameters {','.join([str(x) for x in raise_error])}"
)
class DeviceAdmin(admin.ModelAdmin):
list_display = (
"id",
"short_name",
"description",
"protocol",
"active",
"polling_interval",
"instrument_handler",
)
list_editable = ("active", "polling_interval", "instrument_handler")
list_display_links = (
"short_name",
"description",
)
list_filter = (
"protocol",
"active",
"polling_interval",
)
actions = [silent_delete]
save_as = True
save_as_continue = True
form = DeviceForm
# Add inlines for any model with OneToOne relation with Device
devices = [
field
for field in Device._meta.get_fields()
if issubclass(type(field), OneToOneRel)
]
inlines = populate_inline(
devices, DeviceForm, output=[], stacked=admin.StackedInline
)
item_dict = dict(
model=DeviceHandlerParameter,
max_num=0,
can_delete=False,
formset=DeviceHandlerParameterInlineFormSet,
form=DeviceHandlerParameterInlineForm,
)
inlines.append(type("DeviceHandlerParameter", (admin.StackedInline,), item_dict))
def get_form(self, request, obj=None, **kwargs):
if (
kwargs.get("fields", False)
and "instrument_handler" in kwargs["fields"]
and obj is None
):
help_texts = kwargs.get("help_texts", {})
help_texts.update(
{
"instrument_handler": "If the handler needs specific configuration, save the device and you will add the config next."
}
)
kwargs.update({"help_texts": help_texts})
return super().get_form(request, obj, **kwargs)
def formfield_for_foreignkey(self, db_field, request, **kwargs):
# For new device, show all the protocols from the installed apps in settings.py
# For existing device, show only the selected protocol to avoid changing
if db_field.name == "protocol":
if (
"object_id" in request.resolver_match.kwargs
and Device.objects.get(id=request.resolver_match.kwargs["object_id"])
is not None
and Device.objects.get(
id=request.resolver_match.kwargs["object_id"]
).protocol
):
kwargs["queryset"] = DeviceProtocol.objects.filter(
protocol__in=[
Device.objects.get(
id=request.resolver_match.kwargs["object_id"]
).protocol.protocol,
]
)
else:
# List only activated protocols
protocol_list = list()
protocol_list.append("generic")
if hasattr(settings, "INSTALLED_APPS"):
try:
for protocol in DeviceProtocol.objects.filter(
app_name__in=settings.INSTALLED_APPS
):
protocol_list.append(protocol.protocol)
except (ProgrammingError, OperationalError) as e:
logger.debug(e)
kwargs["queryset"] = DeviceProtocol.objects.filter(
protocol__in=protocol_list
)
return super().formfield_for_foreignkey(db_field, request, **kwargs)
# Add JS file to display the right inline and to hide/show fields
class Media:
js = (
# To be sure the jquery files are loaded before our js file
"admin/js/vendor/jquery/jquery.min.js",
"admin/js/jquery.init.js",
"pyscada/js/admin/display_inline_protocols_device.js",
"pyscada/js/admin/hideshow.js",
)
class DeviceHandlerAdmin(admin.ModelAdmin):
list_display = (
"id",
"name",
"handler_class",
"handler_path",
"found",
)
list_editable = (
"handler_class",
"handler_path",
)
list_display_links = ("name",)
save_as = True
save_as_continue = True
readonly_fields = [
"content",
]
def has_module_permission(self, request):
return False
@admin.display(boolean=True)
def found(self, instance):
try:
if instance.handler_path is not None:
sys.path.append(instance.handler_path)
mod = __import__(instance.handler_class, fromlist=["Handler"])
return True
except ModuleNotFoundError:
return False
except Exception as e:
logger.error(f"Handler {self} failed to be found : {e}")
return False
def content(self, instance):
try:
if instance.handler_path is not None:
sys.path.append(instance.handler_path)
if instance.handler_class in sys.modules:
del sys.modules[instance.handler_class]
mod = __import__(instance.handler_class, fromlist=["Handler"])
if hasattr(mod, "pyscada_admin_content"):
return mark_safe(getattr(mod, "pyscada_admin_content"))
with open(mod.__file__) as f:
return f.read()
except ModuleNotFoundError:
return "Handler file not found."
except Exception as e:
return f"Handler reading failed : {e}"
def get_form(self, request, obj=None, **kwargs):
if kwargs.get("fields", False) and "content" in kwargs["fields"]:
help_texts = kwargs.get("help_texts", {})
help_texts.update(
{
"content": "Return the content of 'pyscada_admin_content' variable if defined in the handler file, otherwise return the whole file content."
}
)
kwargs.update({"help_texts": help_texts})
return super().get_form(request, obj, **kwargs)
def get_readonly_fields(self, request, obj=None):
if obj == None:
return []
return super().get_readonly_fields(request, obj)
class Media:
js = (
# show the contet as preformatted code
"pyscada/js/admin/handler_content_as_pre.js",
)
class VariableHandlerParameterInlineForm(forms.ModelForm):
class Meta:
model = VariableHandlerParameter
fields = ("value",)
class VariableHandlerParameterInlineFormSet(BaseInlineFormSet):
def clean(self):
super().clean()
raise_error = []
if self.instance.device.instrument_handler is not None:
parameters = (
self.instance.device.instrument_handler.get_variable_parameters()
)
else:
parameters = {}
for parameter in parameters:
parameters[parameter]["found"] = False
result_forms = []
for form in self.forms:
if form.instance.name in parameters.keys():
if parameters[form.instance.name]["found"]:
# VariableHandlerParameter already found, delete duplicate
form.instance.delete()
else:
parameters[form.instance.name]["found"] = True
if (
not parameters[form.instance.name].get("null", True)
and form.instance.value == None
):
# value is needed
raise_error.append(form.instance.name)
result_forms.append(form)
else:
# VariableHandlerParameter not needed
try:
form.instance.delete()
except ValueError:
pass
# your custom formset validation
self.forms = result_forms
# TODO : redirect to a specific page if parameters was missing on the add/change page, in order to create these parameters
if len(raise_error):
raise ValidationError(
f"Value is required for parameters {','.join([str(x) for x in raise_error])}"
)
class VariableAdmin(admin.ModelAdmin):
list_filter = (
"device__protocol",
"device",
"active",
"writeable",
"unit__unit",
"value_class",
"scaling",
)
search_fields = [
"name",
]
list_per_page = 10
form = VariableAdminFrom
save_as = True
save_as_continue = True
# Add inlines for any model with OneToOne relation with Device
related_variables = [
field
for field in Variable._meta.get_fields()
if issubclass(type(field), OneToOneRel)
]
inlines = populate_inline(
related_variables,
VariableInlineAdminFrom,
output=[],
stacked=admin.StackedInline,
)
item_dict = dict(
model=VariableHandlerParameter,
max_num=0,
can_delete=False,
formset=VariableHandlerParameterInlineFormSet,
form=VariableHandlerParameterInlineForm,
)
inlines.append(type("VariableHandlerParameter", (admin.StackedInline,), item_dict))
def get_form(self, request, obj=None, **kwargs):
if kwargs.get("fields", False) and "device" in kwargs["fields"] and obj is None:
help_texts = kwargs.get("help_texts", {})
help_texts.update(
{
"device": "If the device handler needs specific configuration, save the variable and you will add the config next."
}
)
kwargs.update({"help_texts": help_texts})
return super().get_form(request, obj, **kwargs)
# Add JS file to display the right inline
class Media:
js = (
# To be sure the jquery files are loaded before our js file
"admin/js/vendor/jquery/jquery.min.js",
"admin/js/jquery.init.js",
"pyscada/js/admin/display_inline_protocols_variable.js",
"pyscada/js/admin/hideshow.js",
)
def device_name(self, instance):
return instance.device.short_name
def unit(self, instance):
return instance.unit.unit
def color_code(self, instance):
return instance.chart_line_color.color_code()
class CoreVariableAdmin(VariableAdmin):
list_display = (
"id",
"name",
"description",
"unit",
"scaling",
"device",
"value_class",
"active",
"writeable",
"dictionary",
)
list_editable = (
"active",
"writeable",
"unit",
"scaling",
"dictionary",
)
list_display_links = ("name",)
def formfield_for_foreignkey(self, db_field, request, **kwargs):
# show only datasource with can_select as True
if db_field.name == "datasource":
ids = []
for d in DataSource.objects.all():
if d.datasource_model.can_select:
ids.append(d.id)
kwargs["queryset"] = DataSource.objects.filter(id__in=ids)
return super().formfield_for_foreignkey(db_field, request, **kwargs)
class ScalingAdmin(admin.ModelAdmin):
list_display = (
"id",
"description",
"input_low",
"input_high",
"output_low",
"output_high",
"limit_input",
)
list_editable = (
"input_low",
"input_high",
"output_low",
"output_high",
"limit_input",
)
list_display_links = ("description",)
save_as = True
save_as_continue = True
class DeviceWriteTaskAdmin(admin.ModelAdmin):
list_display = (
"id",
"name",
"value",
"user_name",
"start_time",
"done",
"failed",
)
# list_editable = ('active','writeable',)
list_display_links = ("name",)
list_filter = (
"done",
"failed",
)
raw_id_fields = ("variable",)
save_as = True
save_as_continue = True
def name(self, instance):
return instance.__str__()
def user_name(self, instance):
try:
return instance.user.username
except:
return "None"
def start_time(self, instance):
return datetime.datetime.fromtimestamp(int(instance.start)).strftime(
"%Y-%m-%d %H:%M:%S"
)
def has_delete_permission(self, request, obj=None):
return True
class DeviceReadTaskAdmin(admin.ModelAdmin):
list_display = (
"id",
"name",
"user_name",
"start_time",
"done",
"failed",
)
list_display_links = ("name",)
list_filter = (
"done",
"failed",
)
raw_id_fields = ("variable",)
save_as = True
save_as_continue = True
def name(self, instance):
return instance.__str__()
def user_name(self, instance):
try:
return instance.user.username
except:
return "None"
def start_time(self, instance):
return datetime.datetime.fromtimestamp(int(instance.start)).strftime(
"%Y-%m-%d %H:%M:%S"
)
class LogAdmin(admin.ModelAdmin):
list_display = (
"id",
"time",
"level",
"message_short",
"user_name",
)
list_display_links = ("message_short",)
list_filter = ("level", "user")
search_fields = [
"message",
]
def user_name(self, instance):
try:
return instance.user.username
except:
return "None"
def time(self, instance):
return datetime.datetime.fromtimestamp(int(instance.timestamp)).strftime(
"%Y-%m-%d %H:%M:%S"
)
def has_add_permission(self, request):
return False
def has_delete_permission(self, request, obj=None):
return False
class BackgroundProcessAdmin(admin.ModelAdmin):
list_display = (
"id",
"pid",
"label",
"message",
"last_update",
"running_since",
"enabled",
"done",
"failed",
)
list_filter = (BackgroundProcessFilter, "enabled", "done", "failed")
list_display_links = ("id", "label", "message")
readonly_fields = ("message", "last_update", "running_since", "done", "failed")
actions = [restart_process, stop_process, kill_process]
class RecordedEventAdmin(admin.ModelAdmin):
list_display = (
"id",
"event",
"complex_event",
"time_begin",
"time_end",
"active",
)
list_display_links = (
"event",
"complex_event",
)
list_filter = ("event", "active")
readonly_fields = (
"time_begin",
"time_end",
)
save_as = True
save_as_continue = True
class MailAdmin(admin.ModelAdmin):
list_display = (
"id",
"subject",
"message",
"html_message",
"last_update",
"done",
"send_fail_count",
)
list_display_links = ("subject",)
list_filter = ("done",)
def last_update(self, instance):
return datetime.datetime.fromtimestamp(int(instance.timestamp)).strftime(
"%Y-%m-%d %H:%M:%S"
)
class ComplexEventOutputAdminInline(admin.TabularInline):
model = ComplexEventOutput
extra = 0
show_change_link = False
fields = ("variable", "value")
class ComplexEventLevelAdminInline(admin.TabularInline):
model = ComplexEventLevel
extra = 0
show_change_link = True
readonly_fields = ("active",)
class ComplexEventInputAdminInline(admin.StackedInline):
model = ComplexEventInput
extra = 0
fieldsets = (
(
None,
{
"fields": (
(
"fixed_limit_low",
"variable_limit_low",
"limit_low_type",
"hysteresis_low",
),
(
"variable",
"variable_property",
),
(
"fixed_limit_high",
"variable_limit_high",
"limit_high_type",
"hysteresis_high",
),
),
},
),
)
raw_id_fields = (
"variable",
"variable_limit_low",
"variable_limit_high",
)
class ComplexEventAdmin(admin.ModelAdmin):
list_display = (
"id",
"label",
"default_send_mail",
"last_level",
)
list_display_links = (
"id",
"label",
)
list_filter = ("default_send_mail",)
filter_horizontal = ("complex_mail_recipients",)
inlines = [ComplexEventLevelAdminInline, ComplexEventOutputAdminInline]
readonly_fields = ("last_level",)
save_as = True
save_as_continue = True
class ComplexEventLevelAdmin(admin.ModelAdmin):
list_display = (
"id",
"level",
"send_mail",
"complex_event",
"order",
"active",
)
list_display_links = ("id",)
list_filter = (
"complex_event__label",
"level",
"send_mail",
)
inlines = [ComplexEventInputAdminInline, ComplexEventOutputAdminInline]
readonly_fields = ("active",)
save_as = True
save_as_continue = True
def has_module_permission(self, request):
return False
class ComplexEventInputAdmin(admin.ModelAdmin):
list_display = (
"id",
"fixed_limit_low",
"variable_limit_low",
"limit_low_type",
"hysteresis_low",
"variable",
"fixed_limit_high",
"variable_limit_high",
"limit_high_type",
"hysteresis_high",
)
list_display_links = ("id",)
list_filter = ("variable",)
save_as = True
save_as_continue = True
raw_id_fields = ("variable",)
class EventAdmin(admin.ModelAdmin):
list_display = (
"id",
"label",
"variable",
"limit_type",
"level",
"action",
)
list_display_links = (
"id",
"label",
)
list_filter = (
"level",
"limit_type",
"action",
)
filter_horizontal = ("mail_recipients",)
save_as = True
save_as_continue = True
raw_id_fields = ("variable",)
class VariablePropertyAdmin(admin.ModelAdmin):
list_display = (
"id",
"variable",
"name",
"property_class",
"value",
"timestamp",
"last_modified",
)
list_display_links = ("id", "variable", "name", "property_class")
list_filter = (
"variable",
"name",
"property_class",
)
raw_id_fields = ("variable",)
readonly_fields = ["last_modified"]
save_as = True
save_as_continue = True
def value(self, instance):
return instance.value()
class DictionaryItemInline(admin.TabularInline):
model = DictionaryItem
extra = 1
class DictionaryAdmin(admin.ModelAdmin):
list_display = (
"id",
"name",
)
list_filter = ("variable",)
save_as = True
save_as_continue = True
inlines = [DictionaryItemInline]
def has_module_permission(self, request):
return False
class DataSourceModelSelect(forms.Select):
def create_option(
self, name, value, label, selected, index, subindex=None, attrs=None
):
option = super().create_option(
name, value, label, selected, index, subindex, attrs
)
if value:
option["attrs"][
"data-inline-datasource-model-name"
] = value.instance.inline_model_name
return option
class DataSourceAdminChangeForm(forms.ModelForm):
class Meta:
model = DataSource
fields = "__all__"
widgets = {"datasource_model": DataSourceModelSelect}
class DataSourceAdminAddForm(forms.ModelForm):
class Meta:
model = DataSource
fields = "__all__"
def __init__(self, *args, **kwargs):
wtf = DataSourceModel.objects.all()
super().__init__(*args, **kwargs)
w = self.fields["datasource_model"].widget
datasource_choices = []
for choice in wtf:
if choice.can_add:
datasource_choices.append((choice.id, choice.__str__()))
w.choices = datasource_choices
def create_option_datasource(
self, name, value, label, selected, index, subindex=None, attrs=None
):
inline_datasource_model_name = DataSourceModel.objects.get(
id=value
).inline_model_name
self.option_inherits_attrs = True
return self._create_option(
name,
value,
label,
selected,
index,
subindex,
attrs={
"data-inline-datasource-model-name": inline_datasource_model_name,
},
)
import types
# from django.forms.widgets import Select
w._create_option = w.create_option # copy old method
w.create_option = types.MethodType(
create_option_datasource, w
) # replace old with new
class DataSourceAdmin(admin.ModelAdmin):
list_display = (
"datasource_model",
"datasource_name",
)
form = DataSourceAdminChangeForm
# Add inlines for any model with OneToOne relation with Device
items = [
field
for field in DataSource._meta.get_fields()
if issubclass(type(field), OneToOneRel)
]
inlines = populate_inline(items, None, output=[], stacked=admin.StackedInline)
# Add JS file to display the right inline and to hide/show fields
class Media:
js = (
# To be sure the jquery files are loaded before our js file
"pyscada/js/admin/display_inline_datasource.js",
)
def get_form(self, request, obj=None, change=None, **kwargs):
if not obj:
# Use a different form only when adding a new record
return DataSourceAdminAddForm
return super().get_form(request, obj=obj, change=change, **kwargs)
def get_formsets_with_inlines(self, request, obj=None):
# disable all the of an inline if the data source model can_change field is false
def get_formset(self, request, obj=None, **kwargs):
formset = self.get_formset(request, obj=None, **kwargs)
for field in formset.form.base_fields:
if not obj.datasource_model.can_change:
formset.form.base_fields[field].disabled = True
return formset
for inline in self.get_inline_instances(request, obj):
if obj is not None:
yield get_formset(inline, request, obj), inline
else:
yield inline.get_formset(request, obj), inline
def datasource_name(self, obj):
return obj.__str__()
def get_deleted_objects(self, objs, request):
# Not allow to delete the data source with id = 1
new_objs = list()
for obj in objs:
if obj.id != 1:
new_objs.append(obj.get_related_datasource())
(
deleted_objects,
model_count,
perms_needed,
protected,
) = super().get_deleted_objects(objs, request)
return deleted_objects, model_count, perms_needed, protected
def has_view_permission(self, request, obj=None):
return True
def has_add_permission(self, request, obj=None):
return True
def has_change_permission(self, request, obj=None):
return True
def has_delete_permission(self, request, obj=None):
if obj is not None and obj.id == 1:
messages.error(request, f"You cannot delete the {obj} !")
return False
return super().has_delete_permission(request, obj)
def formfield_for_foreignkey(self, db_field, request, **kwargs):
# For new data source, show all the data source models
# For existing data source, show only the selected data source model to avoid changing
if db_field.name == "datasource_model":
if (
"object_id" in request.resolver_match.kwargs
and DataSource.objects.get(
id=request.resolver_match.kwargs["object_id"]
)
is not None
and DataSource.objects.get(
id=request.resolver_match.kwargs["object_id"]
).datasource_model
):
kwargs["queryset"] = DataSourceModel.objects.filter(
id=DataSource.objects.get(
id=request.resolver_match.kwargs["object_id"]
).datasource_model.id,
)
return super().formfield_for_foreignkey(db_field, request, **kwargs)
admin_site = PyScadaAdminSite(name="pyscada_admin")
admin_site.register(Device, DeviceAdmin)
admin_site.register(DeviceHandler, DeviceHandlerAdmin)
admin_site.register(Variable, CoreVariableAdmin)
admin_site.register(VariableProperty, VariablePropertyAdmin)
admin_site.register(Scaling, ScalingAdmin)
admin_site.register(Unit)
admin_site.register(ComplexEvent, ComplexEventAdmin)
admin_site.register(ComplexEventLevel, ComplexEventLevelAdmin)
admin_site.register(Event, EventAdmin)
admin_site.register(RecordedEvent, RecordedEventAdmin)
admin_site.register(Mail, MailAdmin)
admin_site.register(DeviceWriteTask, DeviceWriteTaskAdmin)
admin_site.register(DeviceReadTask, DeviceReadTaskAdmin)
admin_site.register(Log, LogAdmin)
admin_site.register(BackgroundProcess, BackgroundProcessAdmin)
admin_site.register(VariableState, VariableStateAdmin)
admin_site.register(User, UserAdmin)
admin_site.register(Group, GroupAdmin)
admin_site.register(Dictionary, DictionaryAdmin)
admin_site.register(DataSource, DataSourceAdmin)
# admin_site.register(DataSourceModel)
================================================
FILE: pyscada/apps.py
================================================
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import os
import logging
from django.apps import AppConfig
from django.utils.translation import gettext_lazy as _
from django.db.utils import ProgrammingError, OperationalError
from django.conf import settings
logger = logging.getLogger(__name__)
class PyScadaConfig(AppConfig):
name = "pyscada"
label = "pyscada"
verbose_name = _("PyScada Core")
path = os.path.dirname(os.path.realpath(__file__))
default_auto_field = "django.db.models.AutoField"
def ready(self):
import pyscada.signals
from pyscada.core import additional_installed_app
for app_name in additional_installed_app:
if app_name not in settings.INSTALLED_APPS:
logger.error(f"{app_name} missing in INSTALLED_APPS")
def pyscada_app_init(self):
logger.debug("Core init app")
try:
from .hmi.models import Theme
if Theme.objects.filter().count():
Theme.objects.first().check_all_themes()
except (ProgrammingError, OperationalError) as e:
logger.debug(e)
try:
from .models import DataSourceModel, DataSource
from .django_datasource.models import DjangoDatabase
from .cache_datasource.models import DjangoCache
from .single_value_datasource.models import DjangoSingleValue
# create the default data source model
# only one data source linked to the RecordedData table can exist
dsm, _ = DataSourceModel.objects.get_or_create(
inline_model_name="DjangoDatabase",
name="Django database",
defaults={
# "name": "Django database",
"can_add": False,
"can_change": False,
"can_select": True,
},
)
ds, _ = DataSource.objects.get_or_create(
id=1,
defaults={
"datasource_model": dsm,
},
)
dd, _ = DjangoDatabase.objects.get_or_create(
datasource=ds,
defaults={
"data_model_app_name": "pyscada.django_datasource",
"data_model_name": "RecordedData",
},
)
# For RecordedDataOld, hidden by default
# set can_select to True to show it in the admin panel.
# TODO : test read and write, test how it appears in the variable admin
# panel config if mannualy added (using shell)
dsm, _ = DataSourceModel.objects.get_or_create(
inline_model_name="DjangoDatabase",
name="Django database hidden",
defaults={
# "name": "Django database",
"can_add": False,
"can_change": False,
"can_select": False,
},
)
ds, _ = DataSource.objects.get_or_create(
id=2,
defaults={
"datasource_model": dsm,
},
)
dd, _ = DjangoDatabase.objects.get_or_create(
datasource=ds,
defaults={
"data_model_app_name": "pyscada.django_datasource",
"data_model_name": "RecordedDataOld",
},
)
# Update datasource name after move to subapp
DjangoDatabase.objects.filter(
data_model_app_name="pyscada",
pk__lte=2).update(data_model_app_name="pyscada.django_datasource")
# Django Cache datastore
dsm, _ = DataSourceModel.objects.get_or_create(
inline_model_name="DjangoCache",
name="Django Cache",
defaults={
"can_add": True,
"can_change": True,
"can_select": True,
},
)
ds, _ = DataSource.objects.get_or_create(
datasource_model=dsm
)
dd, _ = DjangoCache.objects.get_or_create(
datasource=ds,
defaults={
"data_lifetime": 3600,
},
)
# Django Single Value datastore
dsm, _ = DataSourceModel.objects.get_or_create(
inline_model_name="DjangoSingleValue",
name="Django Single Value",
defaults={
"can_add": False,
"can_change": False,
"can_select": True,
},
)
ds, _ = DataSource.objects.get_or_create(
datasource_model=dsm
)
dd, _ = DjangoSingleValue.objects.get_or_create(
datasource=ds,
)
except (ProgrammingError, OperationalError) as e:
logger.debug(e)
================================================
FILE: pyscada/cache_datasource/__init__.py
================================================
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from pyscada import core
__version__ = core.__version__
__author__ = core.__author__
__email__ = core.__email__
__description__ = (
"Cache Datasource for PyScada a Python and Django based Open Source SCADA System"
)
__app_name__ = "cache_datasource"
================================================
FILE: pyscada/cache_datasource/apps.py
================================================
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import logging
from django.apps import AppConfig
from django.utils.translation import gettext_lazy as _
logger = logging.getLogger(__name__)
class PyScadaCacheDatasourceConfig(AppConfig):
name = "pyscada.cache_datasource"
verbose_name = _("PyScada Cache Datasource")
default_auto_field = "django.db.models.AutoField"
================================================
FILE: pyscada/cache_datasource/migrations/0001_initial.py
================================================
# Generated by Django 5.2.10 on 2026-02-10 15:03
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
('pyscada', '0116_variable_pause_recording'),
]
operations = [
migrations.CreateModel(
name='DjangoCache',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('data_lifetime', models.PositiveIntegerField(default=3600)),
('datasource', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to='pyscada.datasource')),
],
),
]
================================================
FILE: pyscada/cache_datasource/migrations/__init__.py
================================================
================================================
FILE: pyscada/cache_datasource/models.py
================================================
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import logging
import time
from django.core.cache import cache
from django.db import models
from django.utils.timezone import now
from pyscada.models import DataSource, Variable
from pyscada.utils import timestamp_to_datetime
logger = logging.getLogger(__name__)
class DjangoCache(models.Model):
datasource = models.OneToOneField(DataSource, on_delete=models.CASCADE)
data_lifetime = models.PositiveIntegerField(default=3600)
def __str__(self):
return f"Django Cache (data lifetime : {self.data_lifetime} seconds)"
@staticmethod
def now_ms() -> int:
"""returns a unixtimestamp in ms"""
return int(now().timestamp() * 1000)
@property
def _data_lifetime_ms(self) -> int:
"""returns the lifetime of data in the cache in ms"""
return self.data_lifetime * 1000
def _make_key(self, variable_id: int) -> str:
"""returns the key to find the Variable data in the cache
Args:
variable_id: Primary Key of the Variable for which the data is stored
Returns:
cache key
"""
return f"{self.pk}_{variable_id}"
def _get_data(self, variable_id: int):
"""returns the data for a given Variable from the cache
Args:
variable_id: Primary Key of the Variable for which the data is stored
Returns:
cache data or None
"""
return cache.get(self._make_key(variable_id))
def _set_data(self, variable_id: int, data: list) -> bool:
"""stores the data for a given Variable in the cache
Args:
variable_id: Primary Key of the Variable for which the data is stored
data: in the form [[timestamp, value, date_saved], ...]
Returns:
cache status
"""
return cache.set(self._make_key(variable_id), data, timeout=self.data_lifetime)
def _update_variable_data(self, variable_id: int, new_data=None, date_saved=None):
"""stores the data for a given Variable in the cache and checks for stale data
Args:
variable_id: Primary Key of the Variable for which the data is stored
new_data: in the form [[timestamp, value, (date_saved)], ...]
date_saved (optional): date when the data was saved
Returns:
cache status
"""
data = self._get_data(variable_id=variable_id)
if data is None:
data = {}
if new_data is None:
new_data = []
date_saved = date_saved if date_saved is not None else now()
# check for old data
for key in list(data.keys()):
if key < (self.now_ms() - self._data_lifetime_ms):
logger.error(
f"{key} smaler than {(self.now_ms() - self._data_lifetime_ms)}"
)
del data[key]
for value in new_data:
data[int(value[0] * 1000)] = [value[0], value[1], date_saved.timestamp()]
return self._set_data(variable_id=variable_id, data=data)
def last_datapoint(self, variable=None, use_date_saved=False, **kwargs):
"""returns the last data for a given Variable in the cache and checks for stale
data
Args:
variable_id: Primary Key of the Variable for which the data is stored
new_data: in the form [[timestamp, value, (date_saved)], ...]
date_saved (optional): date when the data was saved
Returns:
last element
"""
if variable is None:
logger.info(
"No variable defined for DjangoCache last_datapoint function"
)
return None
data = self._get_data(variable_id=variable.pk)
if data is None:
logger.debug(
"No data"
)
return None
last_element = None
for timestamp_ms, item in data.items():
timestamp = item[0]
value = item[1]
if last_element is None:
last_element = [timestamp, value]
continue
if last_element[0] < timestamp:
last_element = [timestamp, value]
if last_element is None:
return None
return last_element
def query_datapoints(
self,
variable_ids=[],
time_min=0,
time_max=None,
query_first_value=False,
time_min_excluded=False,
time_max_excluded=False,
**kwargs,
):
"""returns all data for a list of Variables in the cache in a given periode
Args:
variable_ids: Primary Key of the Variable for which the data is stored
time_min (optional):
time_min (optional):
query_first_value (optional):
time_min_excluded (optional):
time_max_excluded (optional):
Returns:
datapoints
"""
if time_max is None:
time_max = time.time()
variable_ids = self.datasource.datasource_check(
items=variable_ids, items_as_id=True, ids_model=Variable
)
output = {}
output["timestamp"] = 0
output["date_saved_max"] = 0
for variable_id in variable_ids:
data = self._get_data(variable_id=variable_id)
if data is None:
continue
first_value = None
for timestamp_ms, item in data.items():
timestamp = item[0]
value = item[1]
date_saved = item[2]
if timestamp > time_max:
continue
if time_max_excluded and timestamp >= time_max:
continue
if timestamp < time_min or (
time_min_excluded and timestamp <= time_min
):
if not query_first_value:
continue
if first_value is None:
first_value = [timestamp, value, date_saved]
elif first_value[0] < timestamp:
first_value = [timestamp, value, date_saved]
continue
if variable_id not in output:
output[variable_id] = []
output[variable_id].append([timestamp, value])
output["timestamp"] = max(output["timestamp"], timestamp)
output["date_saved_max"] = max(output["date_saved_max"], date_saved)
if query_first_value and first_value is not None:
if variable_id not in output:
output[variable_id] = []
# prepend last value
output[variable_id] = [first_value[0:2]] + output[variable_id]
output["timestamp"] = max(output["timestamp"], first_value[0])
output["date_saved_max"] = max(output["date_saved_max"], first_value[2])
return output
def write_datapoints(self, items=[], date_saved=None, **kwargs):
"""
Args:
datapoints: { variable_id: [[timestamp, value, date_saved]] } with
timestamp in s and date_saved as datetime, timestamp in s or None
date_saved (datetime, optional): time when the data was saved. Defaults to
now()
Returns:
None
"""
items = self.datasource.datasource_check(items)
date_saved = date_saved if date_saved is not None else now()
for item in items:
logger.debug(f"{item} has {len(item.cached_values_to_write)} to write.")
if not hasattr(item, "date_saved") or item.date_saved is None:
item.date_saved = date_saved
self._update_variable_data(
variable_id=item.pk,
new_data=item.cached_values_to_write,
date_saved=item.date_saved,
)
item.date_saved = None
item.erase_cache()
def write_raw_datapoints(self, datapoints: dict, date_saved=None):
"""writes raw datapoints to the database in the form
Args:
datapoints: { variable_id: [[timestamp, value, date_saved]] } with
timestamp in s and date_saved as datetime, timestamp in s or None
date_saved (datetime, optional): time when the data was saved. Defaults to
now()
Returns:
None
"""
for variable_id in datapoints.keys():
for datapoint in datapoints[variable_id]:
if len(datapoint) == 2:
if date_saved is None:
datapoint.append(now())
else:
datapoint.append(date_saved)
elif len(datapoint) == 3:
if datapoint[2] is None:
if date_saved is None:
datapoint[2] = now()
else:
datapoint[2] = date_saved
elif type(datapoint[2]) is int or type(datapoint[2]) is float:
datapoint[2] = timestamp_to_datetime(datapoint[2])
self._update_variable_data(
variable_id=variable_id,
new_data=[[datapoint[0], datapoint[1]]],
date_saved=datapoint[2],
)
================================================
FILE: pyscada/core/__init__.py
================================================
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
__version__ = "0.9.0"
__author__ = "Martin Schröder, Camille Lavayssiere"
__email__ = "team@pyscada.org"
__description__ = "PyScada a Python and Django based Open Source SCADA System"
__app_name__ = "PyScada"
default_app_config = "pyscada.apps.PyScadaConfig"
additional_installed_app = [
"pyscada.core",
"pyscada.hmi",
"pyscada.export",
"pyscada.django_datasource",
"pyscada.cache_datasource",
"pyscada.single_value_datasource"
]
parent_process_list = [
{
"pk": 97,
"label": "pyscada.mail",
"process_class": "pyscada.mail.worker.Process",
"process_class_kwargs": '{"dt_set":30}',
"enabled": True,
},
{
"pk": 96,
"label": "pyscada.event",
"process_class": "pyscada.event.worker.Process",
"process_class_kwargs": '{"dt_set":5}',
"enabled": True,
},
{
"pk": 16,
"label": "pyscada.generic",
"process_class": "pyscada.generic.worker.Process",
"process_class_kwargs": '{"dt_set":5}',
"enabled": True,
},
]
def version():
return __version__
================================================
FILE: pyscada/core/urls.py
================================================
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.apps import apps
import logging
logger = logging.getLogger(__name__)
urlpatterns = []
for app_config in apps.get_app_configs():
if app_config.name.startswith("pyscada.") and app_config.name != "pyscada.core":
try:
m = __import__(f"{app_config.name}.urls", fromlist=[str("a")])
urlpatterns += m.urlpatterns
except ModuleNotFoundError:
pass
except Exception as e:
logger.warning(e, exc_info=True)
================================================
FILE: pyscada/device.py
================================================
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from pyscada.models import DeviceProtocol, VariableProperty
import pyscada
import sys
from time import time, sleep, time_ns
import logging
logger = logging.getLogger(__name__)
PROTOCOL_ID = None
driver_ok = True
class GenericHandlerDevice:
"""
Generic handler device
"""
def __init__(self, pyscada_device, variables):
self._device = pyscada_device
self._variables = variables
self.inst = None
self._device_not_accessible = 0
self._not_accessible_reason = None
if not hasattr(self, "_protocol"):
self._protocol = PROTOCOL_ID
if not hasattr(self, "driver_ok"):
self.driver_ok = driver_ok
def connect(self):
"""
establish a connection to the Instrument
"""
if not self.driver_ok:
return False
if self._device.protocol.id != self._protocol:
try:
p = DeviceProtocol.objects.get(id=self._protocol)
except DeviceProtocol.DoesNotExist:
p = None
logger.warning(
f"Wrong handler selected : it's for {p} device while device protocol is {self._device.protocol}"
)
return False
# self.accessibility()
return True
def accessibility(self):
if self.inst is not None:
if self._device_not_accessible < 1:
self._device_not_accessible = 1
logger.info(f"Connected to device : {self._device}")
else:
if self._device_not_accessible > -1:
self._device_not_accessible = -1
msg = f"Device {self._device} is not accessible."
if self._not_accessible_reason is not None:
msg += f" Reason : {self._not_accessible_reason}"
self._not_accessible_reason = None
logger.info(msg)
return True
def disconnect(self):
if self.inst is not None:
self.inst = None
return True
def before_read(self):
"""
will be called before the first read_data
"""
return self.connect()
def after_read(self):
"""
will be called after the last read_data
"""
return self.disconnect()
def read_data(self, variable_instance):
"""
read values from the device
"""
logger.warning(
f"Handler of {self._device} should overwrite read_data function."
)
return None
def read_data_and_time(self, variable_instance):
"""
read values and timestamps from the device
"""
return self.read_data(variable_instance), self.time()
def read_data_all(self, variables_dict, erase_cache=False):
output = []
if self.before_read():
for item in variables_dict.values():
if item.readable:
value, read_time = self.read_data_and_time(item)
if (
value is not None
and read_time is not None
and item.update_values(
value, read_time, erase_cache=erase_cache
)
):
output.append(item)
self.after_read()
return output
def write_data(self, variable_id, value, task):
"""
write values to the device
"""
if self.connect():
for var in self._variables:
var = self._variables[var]
if variable_id == var.id:
logger.warning(
f"Handler of {self._device} should overwrite write_data function."
)
return None
logger.warning(
f"Variable {variable_id} not in variable list {self._variables} of device {self._device}"
)
return None
def time(self):
return time_ns() / 1000000000
class GenericDevice:
"""
Generic device
"""
def __init__(self, device):
self.variables = {}
self.device = device
if not hasattr(self, "driver_ok"):
self.driver_ok = driver_ok
if not self.driver_ok:
logger.warning(f"Driver import failed for {self.device}")
try:
if (
hasattr(self.device, "instrument_handler")
and self.device.instrument_handler is not None
):
if self.device.instrument_handler.handler_path is not None:
sys.path.append(self.device.instrument_handler.handler_path)
mod = __import__(
self.device.instrument_handler.handler_class, fromlist=["Handler"]
)
device_handler = getattr(mod, "Handler")
self._h = device_handler(self.device, self.variables)
elif hasattr(self, "handler_class"):
self._h = self.handler_class(self.device, self.variables)
else:
self._h = GenericHandlerDevice(self.device, self.variables)
self.driver_handler_ok = True
except (ImportError, ModuleNotFoundError) as e:
self.driver_handler_ok = False
logger.error(
f"Handler import error ({e}) : {self.device.short_name}", exc_info=True
)
# Wait 5 seconds to let changes appears in DB.
sleep(5)
for var in self.device.variable_set.filter(active=1):
if not hasattr(var, str(self.device.protocol.protocol) + "variable"):
continue
self.variables[var.pk] = var
def request_data(self):
output = []
if not self.driver_ok or not self.driver_handler_ok:
logger.info(
f"Cannot request data for {self.device}. Driver is {self.driver_ok}. Handler is {self.driver_handler_ok}."
)
return output
output = self._h.read_data_all(self.variables)
return output
def write_data(self, variable_id, value, task):
"""
write value to a Serial Device
"""
output = []
if not self.driver_ok or not self.driver_handler_ok:
return output
for item in self.variables:
if self.variables[item].id == variable_id:
if not self.variables[item].writeable:
logger.info(
f"Variable '{self.variables[item]}' is not writeable. Write task refused."
)
return False
read_value = self._h.write_data(variable_id, value, task)
if read_value is not None and self.variables[item].update_values(
[read_value], [time_ns() / 1000000000]
):
output.append(self.variables[item])
return output
================================================
FILE: pyscada/django_datasource/__init__.py
================================================
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from pyscada import core
__version__ = core.__version__
__author__ = core.__author__
__email__ = core.__email__
__description__ = (
"Django Datasource for PyScada a Python and Django based Open Source SCADA System"
)
__app_name__ = "django_datasource"
================================================
FILE: pyscada/django_datasource/apps.py
================================================
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.apps import AppConfig
from django.utils.translation import gettext_lazy as _
import logging
logger = logging.getLogger(__name__)
class PyScadaDjangoDatasourceConfig(AppConfig):
name = "pyscada.django_datasource"
verbose_name = _("PyScada Django Datasource")
default_auto_field = "django.db.models.AutoField"
================================================
FILE: pyscada/django_datasource/migrations/0001_initial.py
================================================
# Generated by Django 5.2.10 on 2026-02-02 12:29
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
('pyscada', '0115_remove_recordeddata_variable_and_more'),
]
operations = [
migrations.SeparateDatabaseAndState(
state_operations=[
migrations.CreateModel(
name='DjangoDatabase',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('data_model_app_name', models.CharField(max_length=50)),
('data_model_name', models.CharField(max_length=50)),
('datasource', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to='pyscada.datasource')),
],
options={
'db_table': 'pyscada_djangodatabase',
},
),
migrations.CreateModel(
name='RecordedData',
fields=[
('id', models.BigIntegerField(primary_key=True, serialize=False)),
('date_saved', models.DateTimeField(blank=True, db_index=True, null=True)),
('value_boolean', models.BooleanField(blank=True, default=False)),
('value_int16', models.SmallIntegerField(blank=True, null=True)),
('value_int32', models.IntegerField(blank=True, null=True)),
('value_int64', models.BigIntegerField(blank=True, null=True)),
('value_float64', models.FloatField(blank=True, null=True)),
('variable', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to='pyscada.variable')),
],
options={
'db_table': 'pyscada_recordeddata',
},
),
migrations.CreateModel(
name='RecordedDataOld',
fields=[
('id', models.BigIntegerField(primary_key=True, serialize=False)),
('value_boolean', models.BooleanField(blank=True, default=False)),
('value_int16', models.SmallIntegerField(blank=True, null=True)),
('value_int32', models.IntegerField(blank=True, null=True)),
('value_int64', models.BigIntegerField(blank=True, null=True)),
('value_float64', models.FloatField(blank=True, null=True)),
('variable', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to='pyscada.variable')),
],
options={
'db_table': 'pyscada_recordeddataold',
},
),
],
database_operations=[],
),
]
================================================
FILE: pyscada/django_datasource/migrations/__init__.py
================================================
================================================
FILE: pyscada/django_datasource/models.py
================================================
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import logging
import time
from django.core.exceptions import ValidationError
from django.db import models
from django.db.utils import IntegrityError
from django.utils.timezone import now
from pyscada.models import DataSource, Variable
from pyscada.utils import timestamp_to_datetime
logger = logging.getLogger(__name__)
class RecordedDataManager(models.Manager):
def create_data_element_from_variable(
self, variable, value, timestamp, date_saved=None, **kwargs
):
if value is None:
return None
if date_saved is None:
date_saved = (
variable.date_saved if hasattr(variable, "date_saved") else now()
)
return RecordedData(
timestamp=timestamp,
variable=variable,
value=value,
date_saved=date_saved,
)
def last_element(
self,
time_min=0,
time_max=None,
use_date_saved=True,
timeout=None,
time_min_excluded=False,
time_max_excluded=False,
**kwargs,
):
if time_max is None:
time_max = time.time()
# if True, remove the tim_min point from the range
time_min_offset = 0
if time_min_excluded:
time_min_offset = 2097152
# if True, remove the tim_max point from the range
time_max_offset = 0
if time_max_excluded:
time_max_offset = 2097152
if use_date_saved:
result = (
super()
.get_queryset()
.filter(
date_saved__range=(
timestamp_to_datetime(time_min),
timestamp_to_datetime(time_max),
),
**kwargs,
)
)
if result is not None and len(result) > 0:
if time_min_excluded and result[0].date_saved == timestamp_to_datetime(
time_min
):
result = result[1:]
if time_max_excluded and result[
len(result) - 1
].date_saved == timestamp_to_datetime(time_max):
result = result[: len(result) - 1]
return result.last()
else:
return (
super()
.get_queryset()
.filter(
id__range=(
time_min * 2097152 * 1000 + time_min_offset,
time_max * 2097152 * 1000 + 2097151 - time_max_offset,
),
**kwargs,
)
.last()
)
def db_data(
self,
variable_ids,
time_min,
time_max,
query_first_value=False,
**kwargs,
):
"""
:return:
"""
if kwargs.get("time_min_excluded", False):
time_min = time_min + 0.001
if kwargs.get("time_max_excluded", False):
time_max = time_max - 0.001
variable_ids = [int(pk) for pk in variable_ids]
tmp = list(
super()
.get_queryset()
.filter(
id__range=(
time_min * 2097152 * 1000,
time_max * 2097152 * 1000 + 2097151,
),
# date_saved__range=(
# timestamp_to_datetime(
# time_min - 3660 if query_first_value else time_min
# ),
# timestamp_to_datetime(time_max),
# ),
variable_id__in=variable_ids,
)
.values_list(
"variable_id",
"pk",
"value_float64",
"value_int64",
"value_int32",
"value_int16",
"value_boolean",
"date_saved",
)
)
values = dict()
times = dict()
date_saved_max = 0
tmp_time_max = 0
tmp_time_min = time_max
def get_rd_value(rd_resp):
# return the value from a RecordedData Response
if rd_resp[2] is not None: # float64
return rd_resp[2] # time, value
elif rd_resp[3] is not None: # int64
return rd_resp[3] # time, value
elif rd_resp[4] is not None: # int32
return rd_resp[4] # time, value
elif rd_resp[5] is not None: # int16
return rd_resp[5] # time, value
elif rd_resp[6] is not None: # boolean
return rd_resp[6] # time, value
else:
return 0
for item in tmp:
if item[0] not in variable_ids:
continue
if not item[0] in values:
values[item[0]] = []
times[item[0]] = {"time_min": time_max, "time_max": 0}
tmp_time = float(item[1] - item[0]) / (
2097152.0 * 1000
) # calc the timestamp in seconds
if item[7] is None:
continue
date_saved_max = max(
date_saved_max,
time.mktime(item[7].utctimetuple()) + item[7].microsecond / 1e6,
)
tmp_time_max = max(tmp_time, tmp_time_max)
tmp_time_min = min(tmp_time, tmp_time_min)
values[item[0]].append([tmp_time, get_rd_value(item)])
if tmp_time < times[item[0]]["time_min"]:
times[item[0]]["time_min"] = tmp_time
if tmp_time > times[item[0]]["time_max"]:
times[item[0]]["time_max"] = tmp_time
if query_first_value:
for pk in variable_ids:
if pk not in values:
values[pk] = []
time_max_last_value = time_max
time_max_excluded = False
if pk in times:
time_max_last_value = times[pk]["time_min"]
time_max_excluded = True
last_element = self.last_element(
use_date_saved=False,
time_min=0,
time_max=time_max_last_value,
time_max_excluded=time_max_excluded,
variable_id=pk,
)
if last_element is not None and last_element.date_saved is not None:
tmp_time = last_element.time_value()
values[pk].insert(
0,
[
tmp_time,
last_element.value(),
],
)
date_saved_max = max(
date_saved_max,
time.mktime(last_element.date_saved.utctimetuple())
+ last_element.date_saved.microsecond / 1e6,
)
tmp_time_max = max(tmp_time, tmp_time_max)
# values["timestamp"] = max(tmp_time_max, time_min)
values["timestamp"] = tmp_time_max
values["date_saved_max"] = date_saved_max
return values
class DjangoDatabase(models.Model):
datasource = models.OneToOneField(DataSource, on_delete=models.CASCADE)
data_model_app_name = models.CharField(
max_length=50,
)
data_model_name = models.CharField(
max_length=50,
)
def __str__(self):
return f"Django database ({self.data_model_app_name}.{self.data_model_name})"
def _import_model(self):
class_name = self.data_model_name
class_path = self.data_model_app_name + ".models"
try:
mod = __import__(class_path, fromlist=[class_name])
content_class = getattr(mod, class_name)
if isinstance(content_class, models.base.ModelBase):
return content_class
except ModuleNotFoundError:
logger.info(
f"{class_name} of {class_path} not found. A module is not installed ?"
)
except: # noqa: E722
logger.error(f"{class_path} unhandled exception", exc_info=True)
return None
def last_value(self, **kwargs):
logger.info(
"the use of 'last_value' method is deprecated use 'last_datapoint' instead"
)
return self.last_datapoint(**kwargs)
def last_datapoint(self, variable=None, use_date_saved=False, **kwargs):
if variable is None:
logger.info(
"No variable defined for DjangoDatabase last_datapoint function"
)
return None
data_model = self._import_model()
last_element = data_model.objects.last_element(
use_date_saved=use_date_saved, variable_id=variable.pk, **kwargs
)
if last_element is not None:
return [last_element.time_value(), last_element.value()]
else:
return None
def read_multiple(self, **kwargs):
logger.info(
"the use of 'read_multiple' method is deprecated use 'query_datapoints' instead" # noqa: E501
)
return self.query_datapoints(**kwargs)
def query_datapoints(
self,
variable_ids=[],
time_min=0,
time_max=None,
query_first_value=False,
**kwargs,
):
if time_max is None:
time_max = time.time()
variable_ids = self.datasource.datasource_check(
items=variable_ids, items_as_id=True, ids_model=Variable
)
return self._import_model().objects.db_data(
variable_ids=variable_ids,
time_min=time_min,
time_max=time_max,
query_first_value=query_first_value,
**kwargs,
)
def write_multiple(self, **kwargs):
logger.info(
"the use of 'write_multiple' method is deprecated use 'write_datapoints' instead" # noqa: E501
)
return self.write_datapoints(**kwargs)
def write_datapoints(self, items=[], date_saved=None, batch_size=1000, **kwargs):
"""
Args:
datapoints: { variable_id: [[timestamp, value, date_saved]] } with
timestamp in s and date_saved as datetime, timestamp in s or None
date_saved (datetime, optional): time when the data was saved. Defaults to
now()
batch_size (int): Number of values to safe in bulk_create at once. Defauls
to 1000
Returns:
None
"""
data_model = self._import_model()
items = self.datasource.datasource_check(items)
recorded_datas = []
date_saved = date_saved if date_saved is not None else now()
for item in items:
logger.debug(f"{item} has {len(item.cached_values_to_write)} to write.")
if len(item.cached_values_to_write):
for cached_value in item.cached_values_to_write:
# add date saved if not exist in variable object, if date_saved is
# in kwargs it will be used instead of the variable.date_saved
# (see the create_data_element_from_variable function)
if not hasattr(item, "date_saved") or item.date_saved is None:
item.date_saved = date_saved
# create the recorded data object
rc = data_model.objects.create_data_element_from_variable(
item, cached_value[1], cached_value[0], **kwargs
)
# append the object to the elements to save
if rc is not None:
recorded_datas.append(rc)
try:
data_model.objects.bulk_create(recorded_datas, **kwargs)
except IntegrityError:
logger.debug(
f'{data_model._meta.object_name} objects already exists, retrying ignoring conflicts for : {", ".join(str(i.id) + " " + str(i.variable.id) for i in recorded_datas)}' # noqa: E501
)
data_model.objects.bulk_create(
recorded_datas, ignore_conflicts=True, **kwargs
)
for item in items:
item.date_saved = None
item.erase_cache()
def write_raw_datapoints(self, datapoints: dict, date_saved=None, batch_size=1000):
"""writes raw datapoints to the database in the form
Args:
datapoints: { variable_id: [[timestamp, value, date_saved]] } with
timestamp in s and date_saved as datetime, timestamp in s or None
date_saved (datetime, optional): time when the data was saved. Defaults to
now()
batch_size (int): Number of values to safe in bulk_create at once. Defauls
to 1000
Returns:
None
"""
data_model = self._import_model()
recorded_datas = []
for variable_id in datapoints.keys():
variable = Variable.objects.filter(pk=variable_id).first()
for datapoint in datapoints[variable_id]:
if len(datapoint)==2:
if date_saved is None:
datapoint.append(now())
else:
datapoint.append(date_saved)
elif len(datapoint)==3:
if datapoint[2] is None:
if date_saved is None:
datapoint[2]=now()
else:
datapoint[2]=date_saved
elif (type(datapoint[2]) is int or type(datapoint[2]) is float):
datapoint[2]=timestamp_to_datetime(datapoint[2])
#datapoint[0] *= 1000 # convert timestamp from s to ms
rc = data_model.objects.create_data_element_from_variable(
variable=variable,
value=datapoint[1],
timestamp=datapoint[0],
date_saved=datapoint[2],
)
if rc is not None:
recorded_datas.append(rc)
try:
data_model.objects.bulk_create(recorded_datas, batch_size=batch_size)
except IntegrityError:
logger.debug(
f'{data_model._meta.object_name} objects already exists, retrying ignoring conflicts for : {", ".join(str(i.id) + " " + str(i.variable.id) for i in recorded_datas)}' # noqa: E501
)
data_model.objects.bulk_create(
recorded_datas, ignore_conflicts=True, batch_size=batch_size
)
class Meta:
db_table = "pyscada_djangodatabase"
class RecordedDataOld(models.Model):
"""
Big Int first 42 bits are used for the unixtime in ms, unsigned because we only
store time values that are later than 1970, rest 21 bits are used for the
variable id to have a uniqe primary key
63 bit 111111111111111111111111111111111111111111111111111111111111111
42 bit 111111111111111111111111111111111111111111000000000000000000000
21 bit 1000000000000000000000
"""
id = models.BigIntegerField(primary_key=True)
value_boolean = models.BooleanField(default=False, blank=True) # boolean
value_int16 = models.SmallIntegerField(null=True, blank=True) # int16, uint8, int8
value_int32 = models.IntegerField(
null=True, blank=True
) # uint8, int16, uint16, int32
value_int64 = models.BigIntegerField(null=True, blank=True) # uint32, int64
value_float64 = models.FloatField(null=True, blank=True) # float64
variable = models.ForeignKey(Variable, null=True, on_delete=models.SET_NULL)
def __init__(self, *args, **kwargs):
if "timestamp" in kwargs:
timestamp = kwargs.pop("timestamp")
else:
timestamp = time.time()
if "variable_id" in kwargs:
variable_id = kwargs["variable_id"]
elif "variable" in kwargs:
variable_id = kwargs["variable"].pk
else:
variable_id = None
if variable_id is not None and "id" not in kwargs:
kwargs["id"] = int(int(int(timestamp * 1000) * 2097152) + variable_id)
if "variable" in kwargs and "value" in kwargs:
if kwargs["variable"].value_class.upper() in [
"FLOAT",
"FLOAT64",
"DOUBLE",
"FLOAT32",
"SINGLE",
"REAL",
]:
kwargs["value_float64"] = float(kwargs.pop("value"))
elif kwargs["variable"].scaling and not kwargs[
"variable"
].value_class.upper() in ["BOOL", "BOOLEAN"]:
kwargs["value_float64"] = float(kwargs.pop("value"))
elif kwargs["variable"].value_class.upper() in ["INT64", "UINT32", "DWORD"]:
kwargs["value_int64"] = int(kwargs.pop("value"))
# See https://docs.djangoproject.com/en/stable/ref/models/fields/#bigintegerfield # noqa: E501
if (
kwargs["value_int64"] < -9223372036854775808
or kwargs["value_int64"] > 9223372036854775807
):
raise ValueError(
f"Saving value to RecordedDataOld for {kwargs['variable']} with value class {kwargs['variable'].value_class.upper()} should be in the interval [-9223372036854775808:9223372036854775807], it is {kwargs['value_int64']}" # noqa: E501
)
elif kwargs["variable"].value_class.upper() in [
"WORD",
"UINT",
"UINT16",
"INT32",
]:
kwargs["value_int32"] = int(kwargs.pop("value"))
# See https://docs.djangoproject.com/en/stable/ref/models/fields/#integerfield # noqa: E501
if (
kwargs["value_int32"] < -2147483648
or kwargs["value_int32"] > 2147483647
):
raise ValueError(
f"Saving value to RecordedDataOld for {kwargs['variable']} with value class {kwargs['variable'].value_class.upper()} should be in the interval [-2147483648:2147483647], it is {kwargs['value_int32']}" # noqa: E501
)
elif kwargs["variable"].value_class.upper() in [
"INT16",
"INT8",
"UINT8",
"INT",
]:
kwargs["value_int16"] = int(kwargs.pop("value"))
# See https://docs.djangoproject.com/en/stable/ref/models/fields/#smallintegerfield # noqa: E501
if kwargs["value_int16"] < -32768 or kwargs["value_int16"] > 32767:
raise ValueError(
f"Saving value to RecordedDataOld for {kwargs['variable']} with value class {kwargs['variable'].value_class.upper()} should be in the interval [-32768:32767], it is {kwargs['value_int16']}" # noqa: E501
)
elif kwargs["variable"].value_class.upper() in ["BOOL", "BOOLEAN"]:
kwargs["value_boolean"] = bool(kwargs.pop("value"))
# call the django model __init__
super(RecordedDataOld, self).__init__(*args, **kwargs)
self.timestamp = self.time_value()
def calculate_pk(self, timestamp=None):
"""
calculate the primary key from the timestamp in seconds
"""
if timestamp is None:
timestamp = time.time()
self.pk = int(int(int(timestamp * 1000) * 2097152) + self.variable.pk)
def __str__(self):
return str(self.value())
def time_value(self):
"""
return the timestamp in seconds calculated from the id
"""
return (self.pk - self.variable.pk) / 2097152 / 1000.0 # value in seconds
def value(self, value_class=None):
"""
return the stored value
"""
if value_class is None:
value_class = self.variable.value_class
if value_class.upper() in [
"FLOAT",
"FLOAT64",
"DOUBLE",
"FLOAT32",
"SINGLE",
"REAL",
]:
return self.value_float64
elif self.variable.scaling and not value_class.upper() in ["BOOL", "BOOLEAN"]:
return self.value_float64
elif value_class.upper() in ["INT64", "UINT32", "DWORD"]:
return self.value_int64
elif value_class.upper() in ["WORD", "UINT", "UINT16", "INT32"]:
return self.value_int32
elif value_class.upper() in ["INT16", "INT8", "UINT8"]:
return self.value_int16
elif value_class.upper() in ["BOOL", "BOOLEAN"]:
return self.value_boolean
else:
return None
class Meta:
db_table = "pyscada_recordeddataold"
class RecordedData(models.Model):
"""
id: Big Int first 42 bits are used for the unix time in ms, unsigned because we only
store values that are past 1970, the last 21 bits are used for the
variable id to have a unique primary key
63 bit 111111111111111111111111111111111111111111111111111111111111111
42 bit 111111111111111111111111111111111111111111000000000000000000000
21 bit 1000000000000000000000
date_saved: datetime when the model instance is saved in the database
(will be set in the save method)
"""
id = models.BigIntegerField(primary_key=True)
date_saved = models.DateTimeField(blank=True, null=True, db_index=True)
value_boolean = models.BooleanField(default=False, blank=True) # boolean
value_int16 = models.SmallIntegerField(null=True, blank=True) # int16, uint8, int8
value_int32 = models.IntegerField(
null=True, blank=True
) # uint8, int16, uint16, int32
value_int64 = models.BigIntegerField(null=True, blank=True) # uint32, int64, int48
value_float64 = models.FloatField(null=True, blank=True) # float64, float48
variable = models.ForeignKey(Variable, null=True, on_delete=models.SET_NULL)
objects = RecordedDataManager()
def __init__(self, *args, **kwargs):
timestamp = kwargs.get("timestamp", time.time_ns() / 1000000000)
if "timestamp" in kwargs:
kwargs.pop("timestamp")
if "variable" in kwargs:
variable_id = kwargs["variable"].pk
elif "variable_id" in kwargs:
variable_id = kwargs["variable_id"]
try:
kwargs["variable"] = Variable.objects.get(id=variable_id)
except Variable.DoesNotExist:
raise ValidationError(
f"Variable with id {variable_id} not found. Cannot save data."
)
else:
variable_id = None
if variable_id is not None and "id" not in kwargs:
try:
kwargs["id"] = int(
int(int(float(timestamp) * 1000) * 2097152) + variable_id
)
except (TypeError, ValueError) as e:
raise ValidationError(
f"Cannot save data for variable {kwargs['variable']}, timestamp error : {e}" # noqa: E501
)
if "variable" in kwargs and "value" in kwargs:
if kwargs["variable"].value_class.upper() in [
"FLOAT",
"FLOAT64",
"DOUBLE",
"FLOAT32",
"SINGLE",
"REAL",
"FLOAT48",
]:
kwargs["value_float64"] = float(kwargs.pop("value"))
elif kwargs["variable"].scaling and not kwargs[
"variable"
].value_class.upper() in ["BOOL", "BOOLEAN"]:
kwargs["value_float64"] = float(kwargs.pop("value"))
elif kwargs["variable"].value_class.upper() in ["UINT64"]:
# moving the uint64 range [0, 2**64 - 1] to the int64
# [-2**63, 2**63 - 1] to be stored as a django BigIntegerField
kwargs["value_int64"] = int(kwargs.pop("value")) - 2**63
# See https://docs.djangoproject.com/en/stable/ref/models/fields/#bigintegerfield # noqa: E501
if (
kwargs["value_int64"] < -9223372036854775808
or kwargs["value_int64"] > 9223372036854775807
):
raise ValueError(
f"Saving value to RecordedData for {kwargs['variable']} with value class {kwargs['variable'].value_class.upper()} should be in the interval [0:18446744073709551615], it is {kwargs['value_int64'] + 2**63}" # noqa: E501
)
elif kwargs["variable"].value_class.upper() in [
"INT64",
"UINT32",
"DWORD",
"INT48",
]:
kwargs["value_int64"] = int(kwargs.pop("value"))
# See https://docs.djangoproject.com/en/stable/ref/models/fields/#bigintegerfield # noqa: E501
if (
kwargs["value_int64"] < -9223372036854775808
or kwargs["value_int64"] > 9223372036854775807
):
raise ValueError(
f"Saving value to RecordedData for {kwargs['variable']} with value class {kwargs['variable'].value_class.upper()} should be in the interval [-9223372036854775808:9223372036854775807], it is {kwargs['value_int64']}" # noqa: E501
)
elif kwargs["variable"].value_class.upper() in [
"WORD",
"UINT",
"UINT16",
"INT32",
]:
kwargs["value_int32"] = int(kwargs.pop("value"))
# See https://docs.djangoproject.com/en/stable/ref/models/fields/#integerfield # noqa: E501
if (
kwargs["value_int32"] < -2147483648
or kwargs["value_int32"] > 2147483647
):
raise ValueError(
f"Saving value to RecordedData for {kwargs['variable']} with value class {kwargs['variable'].value_class.upper()} should be in the interval [-2147483648:2147483647], it is {kwargs['value_int32']}" # noqa: E501
)
elif kwargs["variable"].value_class.upper() in [
"INT16",
"INT8",
"UINT8",
"INT",
]:
kwargs["value_int16"] = int(kwargs.pop("value"))
# See https://docs.djangoproject.com/en/stable/ref/models/fields/#smallintegerfield # noqa: E501
if kwargs["value_int16"] < -32768 or kwargs["value_int16"] > 32767:
raise ValueError(
f"Saving value to RecordedData for {kwargs['variable']} with value class {kwargs['variable'].value_class.upper()} should be in the interval [-32768:32767], it is {kwargs['value_int16']}" # noqa: E501
)
elif kwargs["variable"].value_class.upper() in ["BOOL", "BOOLEAN"]:
kwargs["value_boolean"] = bool(kwargs.pop("value"))
else:
logger.warning(
f"The {kwargs['variable'].value_class.upper()} variable value class is not defined in RecordedData __init__ function. Default storing value as float." # noqa: E501
)
kwargs["value_float64"] = float(kwargs.pop("value"))
# call the django model __init__
super(RecordedData, self).__init__(*args, **kwargs)
if self.variable is not None:
self.timestamp = self.time_value()
elif self.date_saved is not None:
self.timestamp = self.date_saved.timestamp()
else:
self.timestamp = time.time()
def calculate_pk(self, timestamp=None):
"""
calculate the primary key from the timestamp in seconds
"""
if timestamp is None:
timestamp = time.time()
self.pk = int(int(int(timestamp * 1000) * 2097152) + self.variable.pk)
def __str__(self):
return str(self.value())
def time_value(self):
"""
return the timestamp in seconds calculated from the id
"""
return (self.pk - self.variable.pk) / 2097152 / 1000.0 # value in seconds
def value(self, value_class=None):
"""
return the stored value
"""
if self.variable is None:
return None
if value_class is None:
value_class = self.variable.value_class
if value_class.upper() in [
"FLOAT",
"FLOAT64",
"DOUBLE",
"FLOAT32",
"SINGLE",
"REAL",
"FLOAT48",
]:
return self.value_float64
elif self.variable.scaling and not value_class.upper() in ["BOOL", "BOOLEAN"]:
return self.value_float64
elif value_class.upper() in ["UINT64"]:
# moving the int64 range [2**63, 2**63 - 1] stored as a django
# BigIntegerField to the int64 [0, 2**64 - 1]
value = self.value_int64
if value is None:
return value
return value + 2**63
elif value_class.upper() in ["INT64", "UINT32", "DWORD", "INT48"]:
return self.value_int64
elif value_class.upper() in ["WORD", "UINT", "UINT16", "INT32"]:
return self.value_int32
elif value_class.upper() in ["INT16", "INT8", "UINT8"]:
return self.value_int16
elif value_class.upper() in ["BOOL", "BOOLEAN"]:
return self.value_boolean
else:
logger.warning(
f"The {value_class.upper()} variable value class is not defined in RecordedData value function. Default reading value as float." # noqa: E501
)
return self.value_float64
def save(self, *args, **kwargs):
if self.date_saved is None:
self.date_saved = now()
super(RecordedData, self).save(*args, **kwargs)
class Meta:
db_table = "pyscada_recordeddata"
================================================
FILE: pyscada/event/__init__.py
================================================
#!/usr/bin/python
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
================================================
FILE: pyscada/event/worker.py
================================================
#!/usr/bin/python
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from pyscada.models import Event, ComplexEvent
from pyscada.utils.scheduler import Process as BaseProcess
import logging
logger = logging.getLogger(__name__)
class Process(BaseProcess):
def __init__(self, dt=5, **kwargs):
super(Process, self).__init__(dt=dt, **kwargs)
def loop(self):
"""
check for events and trigger actions
"""
for item in Event.objects.all():
item.do_event_check()
for item in ComplexEvent.objects.all():
item.do_event_check()
return 1, None
================================================
FILE: pyscada/export/__init__.py
================================================
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from pyscada import core
__version__ = core.__version__
__author__ = core.__author__
parent_process_list = [
{
"pk": 99,
"label": "pyscada.export",
"process_class": "pyscada.export.worker.MasterProcess",
"process_class_kwargs": '{"dt_set":30}',
"enabled": True,
}
]
================================================
FILE: pyscada/export/admin.py
================================================
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from pyscada.admin import admin_site
from pyscada.export.models import ScheduledExportTask, ExportTask
from django.contrib import admin
import logging
logger = logging.getLogger(__name__)
class ScheduledExportTaskAdmin(admin.ModelAdmin):
filter_horizontal = ("variables",)
class ExportTaskAdmin(admin.ModelAdmin):
filter_horizontal = ("variables",)
list_display = (
"id",
"label",
"datetime_start",
"datetime_finished",
"mean_value_period",
"file_format",
"done",
"busy",
"failed",
"downloadlink",
)
list_display_links = ("id", "label")
readonly_fields = (
"filename",
"datetime_finished",
"done",
"busy",
"failed",
"backgroundprocess",
"downloadlink",
)
save_as = True
admin_site.register(ScheduledExportTask, ScheduledExportTaskAdmin)
admin_site.register(ExportTask, ExportTaskAdmin)
================================================
FILE: pyscada/export/apps.py
================================================
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.apps import AppConfig
from django.utils.translation import gettext_lazy as _
import logging
logger = logging.getLogger(__name__)
class PyScadaExportConfig(AppConfig):
name = "pyscada.export"
verbose_name = _("PyScada Export")
default_auto_field = "django.db.models.AutoField"
================================================
FILE: pyscada/export/csv_file.py
================================================
from __future__ import unicode_literals
import csv
import os
import logging
logger = logging.getLogger(__name__)
def unix_time_stamp_to_excel_datenum(timestamp):
"""
convert from unix time (seconds since 01/01/1970) to Excel datenum (days since 01/01/1900)
"""
return (timestamp / 86400.0) + 25569.0
class ExcelCompatibleCSV:
def __init__(self, filename, **kwargs):
self.filename = os.path.expanduser(filename)
self.data = {}
self.header = {}
self.data_rows = 0
self.header_is_writen = False
self.dialect = "excel" # default is excel
def write_data(self, name, data, **kwargs):
if name in self.data:
# append data
self.data[name] += data
self.data_rows = max(self.data_rows, len(self.data[name]))
else:
# new entry
self.data[name] = data
self.data_rows = max(self.data_rows, len(self.data[name])) # update len
self.header[name] = kwargs.copy()
def write_file(self):
# check the data
# data has to have the same len
del_keys = []
for key in self.data:
if len(self.data[key]) != self.data_rows:
del_keys.append(key)
for i in del_keys:
self.data.pop(i, None)
self.header.pop(i, None)
# construct the write arrays
keys = self.data.keys()
output = zip(*self.data.values())
# truncate file on first write, otherwise append
write_mode = "a" if self.header_is_writen else "w"
with open(self.filename, write_mode) as f:
writer = csv.writer(f, dialect=self.dialect)
if not self.header_is_writen:
writer.writerow(keys)
self.header_is_writen = True
writer.writerows(output)
# reset internal data
self.data = {}
self.data_rows = 0
self.header = {}
def reopen(self):
self.write_file()
def close_file(self):
self.write_file()
================================================
FILE: pyscada/export/export.py
================================================
# PyScada
from __future__ import unicode_literals
from pyscada.utils import validate_value_class
from pyscada.models import Variable, BackgroundProcess
from pyscada.export.hdf5_file import MatCompatibleH5
from pyscada.export.hdf5_file import unix_time_stamp_to_matlab_datenum
from pyscada.export.csv_file import ExcelCompatibleCSV
from pyscada.export.csv_file import unix_time_stamp_to_excel_datenum
from pyscada.export.models import ExportTask
from six import string_types
# Django
from django.conf import settings
from django.utils.timezone import now
# other
from datetime import datetime
import os
from time import time, strftime, mktime
from numpy import float64, float32, int32, uint16, int16, uint8, arange
import numpy as np
import math
import logging
logger = logging.getLogger(__name__)
def export_recordeddata_to_file(
time_min=None,
time_max=None,
filename=None,
active_vars=None,
file_extension=None,
append_to_file=False,
no_mean_value=False,
mean_value_period=5.0,
backgroundprocess_id=None,
export_task_id=None,
**kwargs
):
"""
read all data
"""
if backgroundprocess_id is not None:
tp = BackgroundProcess.objects.get(id=backgroundprocess_id)
tp.message = "init"
tp.last_update = now()
tp.save()
else:
tp = None
if isinstance(time_max, string_types):
# convert date strings
time_max = mktime(datetime.strptime(time_max, "%d-%m-%Y %H:%M:%S").timetuple())
if isinstance(time_min, string_types):
# convert date strings
time_min = mktime(datetime.strptime(time_min, "%d-%m-%Y %H:%M:%S").timetuple())
# add default time_min
if time_max is None:
time_max = time() # now
if time_min is None:
time_min = time() - 24 * 60 * 60 # last 24 hours
# add default extension if no extension is given
if file_extension is None and filename is None:
file_extension = ".h5"
elif filename is not None:
file_extension = "." + filename.split(".")[-1]
filename = filename[: len(filename) - len(filename.split(".")[-1]) - 1]
# validate file type
if file_extension not in [".h5", ".mat", ".csv"]:
if tp is not None:
tp.last_update = now()
tp.message = "failed wrong file type"
tp.failed = True
tp.save()
if export_task_id is not None:
job = ExportTask.objects.filter(pk=export_task_id).first()
if job:
job.failed = True
job.save()
return
#
if active_vars is None:
active_vars = Variable.objects.filter(active=1, device__active=1)
else:
if type(active_vars) is str:
if active_vars == "all":
active_vars = Variable.objects.all()
else:
active_vars = Variable.objects.filter(active=1, device__active=1)
else:
active_vars = Variable.objects.filter(
pk__in=active_vars, active=1, device__active=1
)
#
if hasattr(settings, "PYSCADA_EXPORT"):
if "output_folder" in settings.PYSCADA_EXPORT:
backup_file_path = os.path.expanduser(
settings.PYSCADA_EXPORT["output_folder"]
)
else:
backup_file_path = os.path.expanduser("~/measurement_data_dumps")
else:
backup_file_path = os.path.expanduser("~/measurement_data_dumps")
# add filename prefix
backup_file_name = "measurement_data"
if hasattr(settings, "PYSCADA_EXPORT"):
if "file_prefix" in settings.PYSCADA_EXPORT:
backup_file_name = settings.PYSCADA_EXPORT["file_prefix"] + backup_file_name
# create output dir if not existing
if not os.path.exists(backup_file_path):
os.mkdir(backup_file_path)
# filename and suffix
cdstr_from = datetime.fromtimestamp(time_min).strftime("%Y_%m_%d_%H%M")
cdstr_to = datetime.fromtimestamp(time_max).strftime("%Y_%m_%d_%H%M")
if filename is None:
if "filename_suffix" in kwargs:
filename = os.path.join(
backup_file_path,
backup_file_name
+ "_"
+ cdstr_from
+ "_"
+ cdstr_to
+ "_"
+ kwargs["filename_suffix"],
)
else:
filename = os.path.join(
backup_file_path, backup_file_name + "_" + cdstr_from + "_" + cdstr_to
)
else:
filename = os.path.join(backup_file_path, filename)
# check if file exists
if os.path.exists(filename + file_extension) and not append_to_file:
count = 0
filename_old = filename
while os.path.exists(filename + file_extension):
filename = filename_old + "_%03.0f" % count
count += 1
# append the extension
filename = filename + file_extension
# add Filename to ExportTask
if export_task_id is not None:
job = ExportTask.objects.filter(pk=export_task_id).first()
if job:
job.filename = filename
job.save()
if mean_value_period == 0:
no_mean_value = True
mean_value_period = 5.0 # todo get from DB, default is 5 seconds
# calculate time vector
timevalues = arange(
math.ceil(time_min / mean_value_period) * mean_value_period,
math.floor(time_max / mean_value_period) * mean_value_period,
mean_value_period,
)
# get Meta from Settings
if hasattr(settings, "PYSCADA_META"):
if "description" in settings.PYSCADA_META:
description = settings.PYSCADA_META["description"]
else:
description = "None"
if "name" in settings.PYSCADA_META:
name = settings.PYSCADA_META["name"]
else:
name = "None"
else:
description = "None"
name = "None"
if file_extension == ".mat":
bf = MatCompatibleH5(
filename,
version="1.1",
description=description,
name=name,
creation_date=strftime("%d-%b-%Y %H:%M:%S"),
)
out_timevalues = [
unix_time_stamp_to_matlab_datenum(element) for element in timevalues
]
elif file_extension == ".h5":
bf = MatCompatibleH5(
filename,
version="1.1",
description=description,
name=name,
creation_date=strftime("%d-%b-%Y %H:%M:%S"),
)
out_timevalues = timevalues
elif file_extension == ".csv":
bf = ExcelCompatibleCSV(
filename,
version="1.1",
description=description,
name=name,
creation_date=strftime("%d-%b-%Y %H:%M:%S"),
)
out_timevalues = [
unix_time_stamp_to_excel_datenum(element) for element in timevalues
]
else:
return
# less than 24
# read everything
bf.write_data(
"time",
float64(out_timevalues),
id=0,
description="global time vector",
value_class=validate_value_class("FLOAT64"),
unit="Days since 0000-1-1 00:00:00",
color="#000000",
short_name="time",
chart_line_thickness=3,
)
for var_idx in range(0, active_vars.count(), 10):
if tp is not None:
tp.last_update = now()
tp.message = "reading values from database (%d)" % var_idx
tp.save()
# query data
var_slice = active_vars[var_idx : var_idx + 10]
data = Variable.objects.query_datapoints(
variable_ids=list(var_slice.values_list("pk", flat=True)),
time_min=time_min,
time_max=time_max,
query_first_value=True,
)
for var in var_slice:
# write background task info
if tp is not None:
tp.last_update = now()
tp.message = "writing values for %s (%d) to file" % (var.name, var.pk)
tp.save()
# check if variable is scalled
if var.scaling is None or var.value_class.upper() in ["BOOL", "BOOLEAN"]:
value_class = var.value_class
else:
value_class = "FLOAT64"
# read unit
if hasattr(var.unit, "udunit"):
udunit = var.unit.udunit
else:
udunit = "None"
if var.pk not in data:
# write dummy data
bf.write_data(
var.name,
_cast_value(
[0] * len(timevalues), validate_value_class(value_class)
),
id=var.pk,
description=var.description,
value_class=validate_value_class(value_class),
unit=udunit,
color=var.chart_line_color_code(),
short_name=var.short_name,
chart_line_thickness=var.chart_line_thickness,
)
if tp is not None:
tp.last_update = now()
tp.message = "no values for %s (%d) to file" % (var.name, var.pk)
tp.save()
continue
out_data = np.zeros(len(timevalues))
# i # time data index
ii = 0 # source data index
# calculate mean values
last_value = None
max_ii = len(data[var.pk]) - 1
for i in range(len(timevalues)): # iter over time values
if ii >= max_ii + 1:
# if not more data in data source break
if last_value is not None:
out_data[i] = last_value
continue
# init mean value vars
tmp = 0.0 # sum
tmp_i = 0.0 # count
if data[var.pk][ii][0] / 1000.0 < timevalues[i]:
# skip elements that are befor current time step
while data[var.pk][ii][0] / 1000.0 < timevalues[i] and ii < max_ii:
last_value = data[var.pk][ii][1]
ii += 1
if ii >= max_ii:
if last_value is not None:
out_data[i] = last_value
continue
# calc mean value
if (
timevalues[i]
<= data[var.pk][ii][0] / 1000.0
< timevalues[i] + mean_value_period
):
# there is data in time range
while (
timevalues[i]
<= data[var.pk][ii][0] / 1000.0
< timevalues[i] + mean_value_period
and ii < max_ii
):
# calculate mean value
if no_mean_value:
tmp = data[var.pk][ii][1]
tmp_i = 1
else:
tmp += data[var.pk][ii][1]
tmp_i += 1
last_value = data[var.pk][ii][1]
ii += 1
# calc and store mean value
if tmp_i > 0:
out_data[i] = tmp / tmp_i
else:
out_data[i] = data[var.pk][ii][1]
last_value = data[var.pk][ii][1]
else:
# there is no data in time range, keep last value, not mean value
if last_value is not None:
out_data[i] = last_value
# write data
if file_extension == ".h5" or file_extension == ".mat":
var_name = var.name.replace("/", "_") # escape / character,
else:
var_name = var.name
bf.write_data(
var_name,
_cast_value(out_data, validate_value_class(value_class)),
id=var.pk,
description=var.description,
value_class=validate_value_class(value_class),
unit=udunit,
color=var.chart_line_color_code(),
short_name=var.short_name,
chart_line_thickness=var.chart_line_thickness,
)
bf.close_file()
if tp is not None:
tp.last_update = now()
tp.message = "done"
tp.done = True
tp.save()
def _cast_value(value, _type):
"""
cast value to _type
"""
if _type.upper() == "FLOAT64":
return float64(value)
elif _type.upper() == "FLOAT32":
return float32(value)
elif _type.upper() == "INT32":
return int32(value)
elif _type.upper() == "UINT16":
return uint16(value)
elif _type.upper() == "INT16":
return int16(value)
elif _type.upper() == "BOOLEAN":
return uint8(value)
else:
return float64(value)
================================================
FILE: pyscada/export/hdf5_file.py
================================================
# -*- coding: utf-8 -*-
"""
Created on Sat Nov 30 14:22:58 2013
@author: Martin Schröder
"""
from __future__ import unicode_literals
import os
import io
import h5py
import time
import logging
logger = logging.getLogger(__name__)
def unix_time_stamp_to_matlab_datenum(timestamp):
"""
convert dtype to maltab class string
"""
return (timestamp / 86400) + 719529
def dtype_to_matlab_class(dtype):
"""
convert dtype to matlab class string
"""
if dtype.str in ["%s'
% (
self.filename.replace(backup_file_path, "/measurement"),
self.filename.replace(backup_file_path, "/measurement"),
)
)
================================================
FILE: pyscada/export/worker.py
================================================
#!/usr/bin/python
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from pyscada.export.export import export_recordeddata_to_file
from pyscada.export.models import ScheduledExportTask, ExportTask
from pyscada.utils.scheduler import Process as BaseProcess
from pyscada.models import BackgroundProcess
from django.utils.timezone import now
from time import time, gmtime, mktime
from datetime import date, datetime, timedelta
from pytz import UTC
import json
import logging
logger = logging.getLogger(__name__)
try:
import h5py
except:
logger.error("Cannot import h5py", exc_info=True)
class ExportProcess(BaseProcess):
def __init__(self, dt=5, **kwargs):
self.job_id = 0
super(ExportProcess, self).__init__(dt=dt, **kwargs)
def loop(self):
# todo try catch or filter.last()
job = ExportTask.objects.get(pk=self.job_id)
if job.file_format.upper() == "HDF5":
file_ext = ".h5"
elif job.file_format.upper() == "MAT":
file_ext = ".mat"
elif job.file_format.upper() == "CSV_EXCEL":
file_ext = ".csv"
else:
return -1, None
bp = BackgroundProcess.objects.filter(
enabled=True,
done=False,
pid=self.pid,
parent_process__pk=self.parent_process_id,
).first()
if bp is None:
logger.debug("export job %d no BP found" % self.job_id)
return -1, None
job.busy = True
job.backgroundprocess = bp
job.save()
export_recordeddata_to_file(
job.time_min(),
job.time_max(),
filename=None,
active_vars=job.variables.values_list("pk", flat=True),
file_extension=file_ext,
filename_suffix=job.filename_suffix,
backgroundprocess_id=bp.pk,
export_task_id=job.pk,
mean_value_period=job.mean_value_period,
)
job = ExportTask.objects.get(pk=job.pk)
job.done = True
job.busy = False
job.datetime_finished = datetime.now(UTC)
job.save()
bp = BackgroundProcess.objects.filter(
enabled=True,
done=False,
pid=self.pid,
parent_process__pk=self.parent_process_id,
).first()
if bp:
bp.done = True
bp.last_update = now()
if not bp.failed:
bp.message = "stopped"
bp.save()
return 0, None
class MasterProcess(BaseProcess):
"""
handle the registration of new export tasks, and monitor running export tasks
"""
def __init__(self, dt=5, **kwargs):
super(MasterProcess, self).__init__(dt=dt, **kwargs)
self._current_day = gmtime().tm_yday
def loop(self):
"""
this function will be called every self.dt_set seconds
request data
tm_wday 0=Monday
tm_yday
"""
today = date.today()
# only start new jobs after change the day changed
if self._current_day != gmtime().tm_yday:
self._current_day = gmtime().tm_yday
for job in ScheduledExportTask.objects.filter(
active=1
): # get all active jobs
add_task = False
if job.export_period == 1: # daily
start_time = "%s %02d:00:00" % (
(today - timedelta(1)).strftime("%d-%b-%Y"),
job.day_time,
) # "%d-%b-%Y %H:%M:%S"
start_time = mktime(
datetime.strptime(start_time, "%d-%b-%Y %H:%M:%S").timetuple()
)
filename_suffix = "daily_export_%d_%s" % (job.pk, job.label)
add_task = True
elif (
job.export_period == 2 and gmtime().tm_yday % 2 == 0
): # on even days (2,4,...)
start_time = "%s %02d:00:00" % (
(today - timedelta(2)).strftime("%d-%b-%Y"),
job.day_time,
) # "%d-%b-%Y %H:%M:%S"
start_time = mktime(
datetime.strptime(start_time, "%d-%b-%Y %H:%M:%S").timetuple()
)
filename_suffix = "two_day_export_%d_%s" % (job.pk, job.label)
add_task = True
elif (
job.export_period == 7 and gmtime().tm_wday == 0
): # on every monday
start_time = "%s %02d:00:00" % (
(today - timedelta(7)).strftime("%d-%b-%Y"),
job.day_time,
) # "%d-%b-%Y %H:%M:%S"
start_time = mktime(
datetime.strptime(start_time, "%d-%b-%Y %H:%M:%S").timetuple()
)
filename_suffix = "weekly_export_%d_%s" % (job.pk, job.label)
add_task = True
elif (
job.export_period == 14 and gmtime().tm_yday % 14 == 0
): # on every second monday
start_time = "%s %02d:00:00" % (
(today - timedelta(14)).strftime("%d-%b-%Y"),
job.day_time,
) # "%d-%b-%Y %H:%M:%S"
start_time = mktime(
datetime.strptime(start_time, "%d-%b-%Y %H:%M:%S").timetuple()
)
filename_suffix = "two_week_export_%d_%s" % (job.pk, job.label)
add_task = True
elif (
job.export_period == 30 and gmtime().tm_yday % 30 == 0
): # on every 30 days
start_time = "%s %02d:00:00" % (
(today - timedelta(30)).strftime("%d-%b-%Y"),
job.day_time,
) # "%d-%b-%Y %H:%M:%S"
start_time = mktime(
datetime.strptime(start_time, "%d-%b-%Y %H:%M:%S").timetuple()
)
filename_suffix = "30_day_export_%d_%s" % (job.pk, job.label)
add_task = True
if job.day_time == 0:
end_time = "%s %02d:59:59" % (
(today - timedelta(1)).strftime("%d-%b-%Y"),
23,
) # "%d-%b-%Y %H:%M:%S"
else:
end_time = "%s %02d:59:59" % (
today.strftime("%d-%b-%Y"),
job.day_time - 1,
) # "%d-%b-%Y %H:%M:%S"
end_time = mktime(
datetime.strptime(end_time, "%d-%b-%Y %H:%M:%S").timetuple()
)
# create ExportTask
if add_task:
et = ExportTask(
label=filename_suffix,
datetime_max=datetime.fromtimestamp(end_time, UTC),
datetime_min=datetime.fromtimestamp(start_time, UTC),
filename_suffix=filename_suffix,
mean_value_period=job.mean_value_period,
file_format=job.file_format,
datetime_start=datetime.fromtimestamp(end_time + 60, UTC),
)
et.save()
et.variables.add(*job.variables.all())
# check running tasks and start the next Export Task
running_jobs = ExportTask.objects.filter(busy=True, failed=False)
if running_jobs:
for job in running_jobs:
if time() - job.start() < 30:
# only check Task when it is running longer then 30s
continue
if job.backgroundprocess is None:
# if the job has no backgroundprocess assosiated mark as failed
job.failed = True
job.save()
continue
if now() - timedelta(hours=1) > job.backgroundprocess.last_update:
# if the Background Process has been updated in the past 60s wait
continue
if job.backgroundprocess.pid == 0:
# if the job has no valid pid mark as failed
job.failed = True
job.save()
continue
else:
# start the next Export Task
job = ExportTask.objects.filter(
done=False,
busy=False,
failed=False,
datetime_start__lte=datetime.now(UTC),
).first() # get all jobs
if job:
bp = BackgroundProcess(
label="pyscada.export-%d" % job.pk,
message="waiting..",
enabled=True,
parent_process_id=self.parent_process_id,
process_class="pyscada.export.worker.ExportProcess",
process_class_kwargs=json.dumps({"job_id": job.pk}),
)
bp.save()
if job.datetime_start is None:
job.datetime_start = datetime.now(UTC)
job.busy = True
job.save()
# delete all done jobs older the 60 days
for job in ExportTask.objects.filter(
done=True,
busy=False,
datetime_start__gte=datetime.fromtimestamp(time() + 60 * 24 * 60 * 60, UTC),
):
job.delete()
# delete all failed jobs older the 60 days
for job in ExportTask.objects.filter(
failed=True,
datetime_start__gte=datetime.fromtimestamp(time() + 60 * 24 * 60 * 60, UTC),
):
job.delete()
return 1, None # because we have no data to store
================================================
FILE: pyscada/fixtures/color.json
================================================
[
{
"fields": {
"B": 0,
"R": 0,
"name": "auto",
"G": 0
},
"model": "pyscada.color",
"pk": 1
},
{
"fields": {
"B": 64,
"R": 237,
"name": "",
"G": 194
},
"model": "pyscada.color",
"pk": 2
},
{
"fields": {
"B": 248,
"R": 175,
"name": "",
"G": 216
},
"model": "pyscada.color",
"pk": 3
},
{
"fields": {
"B": 75,
"R": 203,
"name": "",
"G": 75
},
"model": "pyscada.color",
"pk": 4
},
{
"fields": {
"B": 77,
"R": 77,
"name": "",
"G": 167
},
"model": "pyscada.color",
"pk": 5
},
{
"fields": {
"B": 237,
"R": 148,
"name": "",
"G": 64
},
"model": "pyscada.color",
"pk": 6
},
{
"fields": {
"B": 51,
"R": 189,
"name": "",
"G": 155
},
"model": "pyscada.color",
"pk": 7
},
{
"fields": {
"B": 198,
"R": 140,
"name": "",
"G": 172
},
"model": "pyscada.color",
"pk": 8
},
{
"fields": {
"B": 60,
"R": 162,
"name": "",
"G": 60
},
"model": "pyscada.color",
"pk": 9
},
{
"fields": {
"B": 61,
"R": 61,
"name": "",
"G": 133
},
"model": "pyscada.color",
"pk": 10
},
{
"fields": {
"B": 189,
"R": 118,
"name": "",
"G": 51
},
"model": "pyscada.color",
"pk": 11
},
{
"fields": {
"B": 76,
"R": 255,
"name": "",
"G": 232
},
"model": "pyscada.color",
"pk": 12
},
{
"fields": {
"B": 255,
"R": 210,
"name": "",
"G": 255
},
"model": "pyscada.color",
"pk": 13
},
{
"fields": {
"B": 90,
"R": 243,
"name": "",
"G": 90
},
"model": "pyscada.color",
"pk": 14
},
{
"fields": {
"B": 92,
"R": 92,
"name": "",
"G": 200
},
"model": "pyscada.color",
"pk": 15
},
{
"fields": {
"B": 255,
"R": 177,
"name": "",
"G": 76
},
"model": "pyscada.color",
"pk": 16
},
{
"fields": {
"B": 38,
"R": 142,
"name": "",
"G": 116
},
"model": "pyscada.color",
"pk": 17
},
{
"fields": {
"B": 148,
"R": 105,
"name": "",
"G": 129
},
"model": "pyscada.color",
"pk": 18
},
{
"fields": {
"B": 45,
"R": 121,
"name": "",
"G": 45
},
"model": "pyscada.color",
"pk": 19
},
{
"fields": {
"B": 46,
"R": 46,
"name": "",
"G": 100
},
"model": "pyscada.color",
"pk": 20
},
{
"fields": {
"B": 142,
"R": 88,
"name": "",
"G": 38
},
"model": "pyscada.color",
"pk": 21
},
{
"fields": {
"B": 89,
"R": 255,
"name": "",
"G": 255
},
"model": "pyscada.color",
"pk": 22
},
{
"fields": {
"B": 255,
"R": 244,
"name": "",
"G": 255
},
"model": "pyscada.color",
"pk": 23
},
{
"fields": {
"B": 105,
"R": 255,
"name": "",
"G": 105
},
"model": "pyscada.color",
"pk": 24
},
{
"fields": {
"B": 107,
"R": 107,
"name": "",
"G": 233
},
"model": "pyscada.color",
"pk": 25
},
{
"fields": {
"B": 255,
"R": 207,
"name": "",
"G": 89
},
"model": "pyscada.color",
"pk": 26
},
{
"fields": {
"B": 25,
"R": 94,
"name": "",
"G": 77
},
"model": "pyscada.color",
"pk": 27
},
{
"fields": {
"B": 99,
"R": 69,
"name": "",
"G": 86
},
"model": "pyscada.color",
"pk": 28
},
{
"fields": {
"B": 29,
"R": 81,
"name": "",
"G": 29
},
"model": "pyscada.color",
"pk": 29
},
{
"fields": {
"B": 30,
"R": 30,
"name": "",
"G": 66
},
"model": "pyscada.color",
"pk": 30
},
{
"fields": {
"B": 94,
"R": 59,
"name": "",
"G": 25
},
"model": "pyscada.color",
"pk": 31
},
{
"fields": {
"B": 102,
"R": 255,
"name": "",
"G": 255
},
"model": "pyscada.color",
"pk": 32
},
{
"fields": {
"B": 255,
"R": 255,
"name": "",
"G": 255
},
"model": "pyscada.color",
"pk": 33
},
{
"fields": {
"B": 120,
"R": 255,
"name": "",
"G": 120
},
"model": "pyscada.color",
"pk": 34
},
{
"fields": {
"B": 123,
"R": 123,
"name": "",
"G": 255
},
"model": "pyscada.color",
"pk": 35
},
{
"fields": {
"B": 255,
"R": 236,
"name": "",
"G": 102
},
"model": "pyscada.color",
"pk": 36
},
{
"fields": {
"B": 64,
"R": 237,
"name": "",
"G": 194
},
"model": "pyscada.color",
"pk": 37
},
{
"fields": {
"B": 248,
"R": 175,
"name": "",
"G": 216
},
"model": "pyscada.color",
"pk": 38
},
{
"fields": {
"B": 75,
"R": 203,
"name": "",
"G": 75
},
"model": "pyscada.color",
"pk": 39
},
{
"fields": {
"B": 77,
"R": 77,
"name": "",
"G": 167
},
"model": "pyscada.color",
"pk": 40
},
{
"fields": {
"B": 237,
"R": 148,
"name": "",
"G": 64
},
"model": "pyscada.color",
"pk": 41
},
{
"fields": {
"B": 51,
"R": 189,
"name": "",
"G": 155
},
"model": "pyscada.color",
"pk": 42
},
{
"fields": {
"B": 198,
"R": 140,
"name": "",
"G": 172
},
"model": "pyscada.color",
"pk": 43
},
{
"fields": {
"B": 60,
"R": 162,
"name": "",
"G": 60
},
"model": "pyscada.color",
"pk": 44
},
{
"fields": {
"B": 61,
"R": 61,
"name": "",
"G": 133
},
"model": "pyscada.color",
"pk": 45
},
{
"fields": {
"B": 189,
"R": 118,
"name": "",
"G": 51
},
"model": "pyscada.color",
"pk": 46
},
{
"fields": {
"B": 76,
"R": 255,
"name": "",
"G": 232
},
"model": "pyscada.color",
"pk": 47
},
{
"fields": {
"B": 255,
"R": 210,
"name": "",
"G": 255
},
"model": "pyscada.color",
"pk": 48
},
{
"fields": {
"B": 90,
"R": 243,
"name": "",
"G": 90
},
"model": "pyscada.color",
"pk": 49
},
{
"fields": {
"B": 92,
"R": 92,
"name": "",
"G": 200
},
"model": "pyscada.color",
"pk": 50
},
{
"fields": {
"B": 255,
"R": 177,
"name": "",
"G": 76
},
"model": "pyscada.color",
"pk": 51
},
{
"fields": {
"B": 143,
"R": 0,
"name": "",
"G": 0
},
"model": "pyscada.color",
"pk": 52
},
{
"fields": {
"B": 159,
"R": 0,
"name": "",
"G": 0
},
"model": "pyscada.color",
"pk": 53
},
{
"fields": {
"B": 175,
"R": 0,
"name": "",
"G": 0
},
"model": "pyscada.color",
"pk": 54
},
{
"fields": {
"B": 191,
"R": 0,
"name": "",
"G": 0
},
"model": "pyscada.color",
"pk": 55
},
{
"fields": {
"B": 207,
"R": 0,
"name": "",
"G": 0
},
"model": "pyscada.color",
"pk": 56
},
{
"fields": {
"B": 223,
"R": 0,
"name": "",
"G": 0
},
"model": "pyscada.color",
"pk": 57
},
{
"fields": {
"B": 239,
"R": 0,
"name": "",
"G": 0
},
"model": "pyscada.color",
"pk": 58
},
{
"fields": {
"B": 255,
"R": 0,
"name": "",
"G": 0
},
"model": "pyscada.color",
"pk": 59
},
{
"fields": {
"B": 255,
"R": 0,
"name": "",
"G": 16
},
"model": "pyscada.color",
"pk": 60
},
{
"fields": {
"B": 255,
"R": 0,
"name": "",
"G": 32
},
"model": "pyscada.color",
"pk": 61
},
{
"fields": {
"B": 255,
"R": 0,
"name": "",
"G": 48
},
"model": "pyscada.color",
"pk": 62
},
{
"fields": {
"B": 255,
"R": 0,
"name": "",
"G": 64
},
"model": "pyscada.color",
"pk": 63
},
{
"fields": {
"B": 255,
"R": 0,
"name": "",
"G": 80
},
"model": "pyscada.color",
"pk": 64
},
{
"fields": {
"B": 255,
"R": 0,
"name": "",
"G": 96
},
"model": "pyscada.color",
"pk": 65
},
{
"fields": {
"B": 255,
"R": 0,
"name": "",
"G": 112
},
"model": "pyscada.color",
"pk": 66
},
{
"fields": {
"B": 255,
"R": 0,
"name": "",
"G": 128
},
"model": "pyscada.color",
"pk": 67
},
{
"fields": {
"B": 255,
"R": 0,
"name": "",
"G": 143
},
"model": "pyscada.color",
"pk": 68
},
{
"fields": {
"B": 255,
"R": 0,
"name": "",
"G": 159
},
"model": "pyscada.color",
"pk": 69
},
{
"fields": {
"B": 255,
"R": 0,
"name": "",
"G": 175
},
"model": "pyscada.color",
"pk": 70
},
{
"fields": {
"B": 255,
"R": 0,
"name": "",
"G": 191
},
"model": "pyscada.color",
"pk": 71
},
{
"fields": {
"B": 255,
"R": 0,
"name": "",
"G": 207
},
"model": "pyscada.color",
"pk": 72
},
{
"fields": {
"B": 255,
"R": 0,
"name": "",
"G": 223
},
"model": "pyscada.color",
"pk": 73
},
{
"fields": {
"B": 255,
"R": 0,
"name": "",
"G": 239
},
"model": "pyscada.color",
"pk": 74
},
{
"fields": {
"B": 255,
"R": 0,
"name": "",
"G": 255
},
"model": "pyscada.color",
"pk": 75
},
{
"fields": {
"B": 239,
"R": 16,
"name": "",
"G": 255
},
"model": "pyscada.color",
"pk": 76
},
{
"fields": {
"B": 223,
"R": 32,
"name": "",
"G": 255
},
"model": "pyscada.color",
"pk": 77
},
{
"fields": {
"B": 207,
"R": 48,
"name": "",
"G": 255
},
"model": "pyscada.color",
"pk": 78
},
{
"fields": {
"B": 191,
"R": 64,
"name": "",
"G": 255
},
"model": "pyscada.color",
"pk": 79
},
{
"fields": {
"B": 175,
"R": 80,
"name": "",
"G": 255
},
"model": "pyscada.color",
"pk": 80
},
{
"fields": {
"B": 159,
"R": 96,
"name": "",
"G": 255
},
"model": "pyscada.color",
"pk": 81
},
{
"fields": {
"B": 143,
"R": 112,
"name": "",
"G": 255
},
"model": "pyscada.color",
"pk": 82
},
{
"fields": {
"B": 128,
"R": 128,
"name": "",
"G": 255
},
"model": "pyscada.color",
"pk": 83
},
{
"fields": {
"B": 112,
"R": 143,
"name": "",
"G": 255
},
"model": "pyscada.color",
"pk": 84
},
{
"fields": {
"B": 96,
"R": 159,
"name": "",
"G": 255
},
"model": "pyscada.color",
"pk": 85
},
{
"fields": {
"B": 80,
"R": 175,
"name": "",
"G": 255
},
"model": "pyscada.color",
"pk": 86
},
{
"fields": {
"B": 64,
"R": 191,
"name": "",
"G": 255
},
"model": "pyscada.color",
"pk": 87
},
{
"fields": {
"B": 48,
"R": 207,
"name": "",
"G": 255
},
"model": "pyscada.color",
"pk": 88
},
{
"fields": {
"B": 32,
"R": 223,
"name": "",
"G": 255
},
"model": "pyscada.color",
"pk": 89
},
{
"fields": {
"B": 16,
"R": 239,
"name": "",
"G": 255
},
"model": "pyscada.color",
"pk": 90
},
{
"fields": {
"B": 0,
"R": 255,
"name": "",
"G": 255
},
"model": "pyscada.color",
"pk": 91
},
{
"fields": {
"B": 0,
"R": 255,
"name": "",
"G": 239
},
"model": "pyscada.color",
"pk": 92
},
{
"fields": {
"B": 0,
"R": 255,
"name": "",
"G": 223
},
"model": "pyscada.color",
"pk": 93
},
{
"fields": {
"B": 0,
"R": 255,
"name": "",
"G": 207
},
"model": "pyscada.color",
"pk": 94
},
{
"fields": {
"B": 0,
"R": 255,
"name": "",
"G": 191
},
"model": "pyscada.color",
"pk": 95
},
{
"fields": {
"B": 0,
"R": 255,
"name": "",
"G": 175
},
"model": "pyscada.color",
"pk": 96
},
{
"fields": {
"B": 0,
"R": 255,
"name": "",
"G": 159
},
"model": "pyscada.color",
"pk": 97
},
{
"fields": {
"B": 0,
"R": 255,
"name": "",
"G": 143
},
"model": "pyscada.color",
"pk": 98
},
{
"fields": {
"B": 0,
"R": 255,
"name": "",
"G": 128
},
"model": "pyscada.color",
"pk": 99
},
{
"fields": {
"B": 0,
"R": 255,
"name": "",
"G": 112
},
"model": "pyscada.color",
"pk": 100
},
{
"fields": {
"B": 0,
"R": 255,
"name": "",
"G": 96
},
"model": "pyscada.color",
"pk": 101
},
{
"fields": {
"B": 0,
"R": 255,
"name": "",
"G": 80
},
"model": "pyscada.color",
"pk": 102
},
{
"fields": {
"B": 0,
"R": 255,
"name": "",
"G": 64
},
"model": "pyscada.color",
"pk": 103
},
{
"fields": {
"B": 0,
"R": 255,
"name": "",
"G": 48
},
"model": "pyscada.color",
"pk": 104
},
{
"fields": {
"B": 0,
"R": 255,
"name": "",
"G": 32
},
"model": "pyscada.color",
"pk": 105
},
{
"fields": {
"B": 0,
"R": 255,
"name": "",
"G": 16
},
"model": "pyscada.color",
"pk": 106
},
{
"fields": {
"B": 0,
"R": 255,
"name": "",
"G": 0
},
"model": "pyscada.color",
"pk": 107
},
{
"fields": {
"B": 0,
"R": 239,
"name": "",
"G": 0
},
"model": "pyscada.color",
"pk": 108
},
{
"fields": {
"B": 0,
"R": 223,
"name": "",
"G": 0
},
"model": "pyscada.color",
"pk": 109
},
{
"fields": {
"B": 0,
"R": 207,
"name": "",
"G": 0
},
"model": "pyscada.color",
"pk": 110
},
{
"fields": {
"B": 0,
"R": 191,
"name": "",
"G": 0
},
"model": "pyscada.color",
"pk": 111
},
{
"fields": {
"B": 0,
"R": 175,
"name": "",
"G": 0
},
"model": "pyscada.color",
"pk": 112
},
{
"fields": {
"B": 0,
"R": 159,
"name": "",
"G": 0
},
"model": "pyscada.color",
"pk": 113
},
{
"fields": {
"B": 0,
"R": 143,
"name": "",
"G": 0
},
"model": "pyscada.color",
"pk": 114
},
{
"fields": {
"B": 0,
"R": 128,
"name": "",
"G": 0
},
"model": "pyscada.color",
"pk": 115
},
{
"fields": {
"B": 255,
"R": 0,
"name": "",
"G": 0
},
"model": "pyscada.color",
"pk": 116
},
{
"fields": {
"B": 0,
"R": 0,
"name": "",
"G": 128
},
"model": "pyscada.color",
"pk": 117
},
{
"fields": {
"B": 0,
"R": 255,
"name": "",
"G": 0
},
"model": "pyscada.color",
"pk": 118
},
{
"fields": {
"B": 191,
"R": 0,
"name": "",
"G": 191
},
"model": "pyscada.color",
"pk": 119
},
{
"fields": {
"B": 191,
"R": 191,
"name": "",
"G": 0
},
"model": "pyscada.color",
"pk": 120
},
{
"fields": {
"B": 0,
"R": 191,
"name": "",
"G": 191
},
"model": "pyscada.color",
"pk": 121
},
{
"fields": {
"B": 64,
"R": 64,
"name": "",
"G": 64
},
"model": "pyscada.color",
"pk": 122
},
{
"fields": {
"B": 230,
"R": 251,
"name": "pink",
"G": 101
},
"model": "pyscada.color",
"pk": 123
},
{
"fields": {
"B": 153,
"R": 255,
"name": "hell gelb",
"G": 255
},
"model": "pyscada.color",
"pk": 124
}
]
================================================
FILE: pyscada/fixtures/units.json
================================================
[{"fields": {"description": "celsius", "unit": "\u00b0C", "udunit": "celsius"}, "model": "pyscada.unit", "pk": 1}, {"fields": {"description": "bit", "unit": "-", "udunit": "bit"}, "model": "pyscada.unit", "pk": 2}, {"fields": {"description": "meter3/hour", "unit": "m\u00b3/h", "udunit": "meter3/hour"}, "model": "pyscada.unit", "pk": 3}, {"fields": {"description": "percent", "unit": "%", "udunit": "percent"}, "model": "pyscada.unit", "pk": 4}, {"fields": {"description": "millibar", "unit": "mbar", "udunit": "millibar"}, "model": "pyscada.unit", "pk": 5}, {"fields": {"description": "bar", "unit": "bar", "udunit": "bar"}, "model": "pyscada.unit", "pk": 6}, {"fields": {"description": "liter/sec", "unit": "l/s", "udunit": "liter/sec"}, "model": "pyscada.unit", "pk": 7}, {"fields": {"description": "sec", "unit": "sec", "udunit": "sec"}, "model": "pyscada.unit", "pk": 8}, {"fields": {"description": "kilogram/kilogram", "unit": "kg/kg", "udunit": "kilogram/kilogram"}, "model": "pyscada.unit", "pk": 9}, {"fields": {"description": "kilogram/sec", "unit": "kg/s", "udunit": "kilogram/sec"}, "model": "pyscada.unit", "pk": 10}, {"fields": {"description": "kilojoule/kilogramkelvin", "unit": "kJ/kgK", "udunit": "kilojoule/kilogramkelvin"}, "model": "pyscada.unit", "pk": 11}, {"fields": {"description": "kilowatt", "unit": "kW", "udunit": "kilowatt"}, "model": "pyscada.unit", "pk": 12}, {"fields": {"description": "kelvin", "unit": "K", "udunit": "kelvin"}, "model": "pyscada.unit", "pk": 13}, {"fields": {"description": "kilowatthour", "unit": "kWh", "udunit": "kilowatthour"}, "model": "pyscada.unit", "pk": 14}, {"fields": {"description": "meter3", "unit": "m\u00b3", "udunit": "meter3"}, "model": "pyscada.unit", "pk": 15}, {"fields": {"description": "", "unit": "", "udunit": ""}, "model": "pyscada.unit", "pk": 16}]
================================================
FILE: pyscada/generic/__init__.py
================================================
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from pyscada import core
__version__ = core.__version__
__author__ = core.__author__
__email__ = core.__email__
__description__ = (
"Generic extension for PyScada a Python and Django based Open Source SCADA System"
)
__app_name__ = "Generic"
PROTOCOL_ID = 1
================================================
FILE: pyscada/generic/device.py
================================================
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from pyscada.device import GenericDevice
from .devices import GenericDevice as GenericHandlerDevice
driver_ok = True
from time import time
import logging
logger = logging.getLogger(__name__)
class Device(GenericDevice):
def __init__(self, device):
self.driver_ok = driver_ok
self.handler_class = GenericHandlerDevice
super().__init__(device)
for var in self.device.variable_set.filter(active=1):
self.variables[var.pk] = var
if self.driver_ok and self.driver_handler_ok:
self._h.connect()
else:
logger.warning(f"Cannot import handler for {self.device}")
================================================
FILE: pyscada/generic/devices/__init__.py
================================================
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from .. import PROTOCOL_ID
from pyscada.models import DeviceProtocol
from pyscada.device import GenericHandlerDevice
from django.conf import settings
driver_ok = True
import logging
logger = logging.getLogger(__name__)
class GenericDevice(GenericHandlerDevice):
def __init__(self, pyscada_device, variables):
super().__init__(pyscada_device, variables)
self._protocol = PROTOCOL_ID
self.driver_ok = driver_ok
def connect(self):
return True
def read_data(self, variable_instance):
"""
Generic dummy device : Don't read nothing.
"""
return None
def write_data(self, variable_id, value, task):
"""
Generic dummy device : Don't write nothing.
"""
return None
================================================
FILE: pyscada/generic/devices/dummy.py
================================================
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from pyscada.generic.devices import GenericDevice
import logging
logger = logging.getLogger(__name__)
class Handler(GenericDevice):
"""
Generic dummy device
"""
def write_data(self, variable_id, value, task):
"""
Generic dummy device : return the value to write.
"""
return value
================================================
FILE: pyscada/generic/devices/waveform.py
================================================
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from pyscada.generic.devices import GenericDevice
from pyscada.models import VariableProperty
from scipy import signal
import numpy as np
from time import time_ns
import logging
logger = logging.getLogger(__name__)
class Handler(GenericDevice):
"""
Generic dummy device
"""
def read_data_and_time(self, variable_instance):
"""
Generic waveform device : use variable properties to configure the waveform.
"""
t = time_ns() / 1000000000.0
default = {
"type": "sinus", # sinus, square, triangle
"amplitude": 1.0, # peak to peak value
"offset": 0.0, # waveform offset value
"start_timestamp": 0.0, # in second from 01/01/1970 00:00:00
"frequency": 0.1, # Hz
"duty_cycle": 0.5, # between 0 and 1, duty cycle for square and for triangle : Width of the rising ramp as a proportion of the total cycle. Default is 1, producing a rising ramp, while 0 produces a falling ramp. width = 0.5 produces a triangle wave. If an array, causes wave shape to change over time, and must be the same length as t.
}
def type_default(fct):
if str(fct) in ["sinus", "square", "triangle"]:
return str(fct)
else:
return "sinus"
def positive_float(i):
if i >= 0:
return i
else:
return 0
def number(i):
try:
return float(i)
except Exception as e:
logger.warning(f"A waveform property is not a number, it is {i}")
return 0
def positive_float_strict(i):
if i > 0:
return i
else:
return 1
def duty_cycle(i):
if i >= 0 and i <= 1:
return i
else:
return 0.5
default_allowed = {
"type": type_default,
"amplitude": positive_float_strict,
"offset": number,
"start_timestamp": positive_float,
"frequency": positive_float_strict,
"duty_cycle": duty_cycle,
}
for prop in default:
vp = VariableProperty.objects.filter(variable=variable_instance, name=prop)
if vp.exists():
default[prop] = default_allowed[prop](vp.first().value())
if default["type"] == "sinus":
out = (
default["amplitude"]
/ 2.0
* np.sin(
2.0
* np.pi
* (t - default["start_timestamp"])
* default["frequency"]
)
+ default["offset"]
)
elif default["type"] == "square":
out = (
default["amplitude"]
/ 2.0
* signal.square(
2.0
* np.pi
* (t - default["start_timestamp"])
* default["frequency"],
default["duty_cycle"],
)
+ default["offset"]
)
elif default["type"] == "triangle":
out = (
default["amplitude"]
/ 2.0
* signal.sawtooth(
2.0
* np.pi
* (t - default["start_timestamp"])
* default["frequency"],
default["duty_cycle"],
)
+ default["offset"]
)
return out, t
def write_data(self, variable_id, value, task):
"""
Generic dummy device : return the value to write.
"""
return value
================================================
FILE: pyscada/generic/worker.py
================================================
#!/usr/bin/python
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from pyscada.utils.scheduler import SingleDeviceDAQProcessWorker
from pyscada.generic import PROTOCOL_ID, __app_name__
import logging
logger = logging.getLogger(__name__)
class Process(SingleDeviceDAQProcessWorker):
device_filter = dict(protocol_id=PROTOCOL_ID)
bp_label = "pyscada." + __app_name__.lower() + "-%s"
def __init__(self, dt=5, **kwargs):
super(SingleDeviceDAQProcessWorker, self).__init__(dt=dt, **kwargs)
================================================
FILE: pyscada/hmi/__init__.py
================================================
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from pyscada import core
__version__ = core.__version__
__author__ = core.__author__
================================================
FILE: pyscada/hmi/admin.py
================================================
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from pyscada.admin import admin_site
from pyscada.models import Variable
from pyscada.models import Color
from pyscada.hmi.models import ControlItem
from pyscada.hmi.models import Chart, ChartAxis
from pyscada.hmi.models import Form
from pyscada.hmi.models import SlidingPanelMenu
from pyscada.hmi.models import Page
from pyscada.hmi.models import GroupDisplayPermission
from pyscada.hmi.models import ControlPanel
from pyscada.hmi.models import (
DisplayValueOption,
ControlElementOption,
DisplayValueColorOption,
DisplayValueOptionTemplate,
)
from pyscada.hmi.models import CustomHTMLPanel
from pyscada.hmi.models import Widget
from pyscada.hmi.models import View, ExternalView
from pyscada.hmi.models import ProcessFlowDiagram
from pyscada.hmi.models import ProcessFlowDiagramItem
from pyscada.hmi.models import Pie
from pyscada.hmi.models import Theme
from pyscada.hmi.models import CssClass
from pyscada.hmi.models import TransformData
from django.utils.translation import gettext_lazy as _
from django.contrib import admin
from django import forms
from django.db.models.fields.related import OneToOneRel
from django.core.exceptions import ValidationError
from django.template.exceptions import TemplateDoesNotExist, TemplateSyntaxError
from django.template.loader import get_template
import logging
logger = logging.getLogger(__name__)
class FormListFilter(admin.SimpleListFilter):
# Human-readable title which will be displayed in the
# right admin sidebar just above the filter options.
title = _("form filter")
# Parameter for the filter that will be used in the URL query.
parameter_name = "form"
def lookups(self, request, model_admin):
"""
Returns a list of tuples. The first element in each
tuple is the coded value for the option that will
appear in the URL query. The second element is the
human-readable name for the option that will appear
in the right sidebar.
"""
result = list()
for form in Form.objects.all():
result.append(
(form.pk, form.title),
)
return result
def queryset(self, request, queryset):
"""
Returns the filtered queryset based on the value
provided in the query string and retrievable via
`self.value()`.
"""
# Compare the requested value (either '80s' or '90s')
# to decide how to filter the queryset.
if self.value() is not None:
return queryset.filter(control_items_form__in=self.value())
class ChartForm(forms.ModelForm):
def __init__(self, *args, **kwargs):
super(ChartForm, self).__init__(*args, **kwargs)
wtf = Variable.objects.all()
w = self.fields["variables"].widget
choices = []
for choice in wtf:
choices.append(
(choice.id, choice.name + "( " + choice.unit.description + " )")
)
w.choices = choices
class ChartAxisInline(admin.TabularInline):
model = ChartAxis
filter_vertical = ["variables"]
def get_extra(self, request, obj=None, **kwargs):
return 0 if obj else 1
class ChartAdmin(admin.ModelAdmin):
list_per_page = 100
# ordering = ['position',]
search_fields = [
"title",
]
List_display_link = ("title",)
list_display = (
"id",
"title",
"x_axis_label",
"x_axis_linlog",
)
# list_filter = ('widget__page__title', 'widget__title',)
# form = ChartForm
save_as = True
save_as_continue = True
inlines = [ChartAxisInline]
def name(self, instance):
return instance.variables.name
def formfield_for_foreignkey(self, db_field, request, **kwargs):
if db_field.name == "x_axis_var":
kwargs["empty_label"] = "Time series"
return super(ChartAdmin, self).formfield_for_foreignkey(
db_field, request, **kwargs
)
class PieForm(forms.ModelForm):
def __init__(self, *args, **kwargs):
super(PieForm, self).__init__(*args, **kwargs)
wtf = Variable.objects.all()
w = self.fields["variables"].widget
choices = []
for choice in wtf:
choices.append(
(choice.id, choice.name + "( " + choice.unit.description + " )")
)
w.choices = choices
class PieAdmin(admin.ModelAdmin):
list_per_page = 100
# ordering = ['position',]
search_fields = [
"name",
]
filter_horizontal = ("variables", "variable_properties")
List_display_link = ("title",)
list_display = ("id", "title")
form = PieForm
save_as = True
save_as_continue = True
def name(self, instance):
return instance.variables.name
class FormAdmin(admin.ModelAdmin):
filter_horizontal = (
"control_items",
"hidden_control_items_to_true",
)
list_filter = ("controlpanel",)
save_as = True
save_as_continue = True
class DisplayValueOptionAdminFrom(forms.ModelForm):
def __init__(self, *args, **kwargs):
super(DisplayValueOptionAdminFrom, self).__init__(*args, **kwargs)
wtf = Color.objects.all()
w = self.fields["color"].widget
color_choices = [(None, None)]
for choice in wtf:
color_choices.append((choice.id, choice.color_code()))
w.choices = color_choices
def create_option_color(
self, name, value, label, selected, index, subindex=None, attrs=None
):
if label is None:
return self._create_option(
name, value, label, selected, index, subindex, attrs=None
)
font_color = hex(int("ffffff", 16) - int(label[1::], 16))[2::]
# attrs = self.build_attrs(attrs,{'style':'background: %s; color: #%s'%(label,font_color)})
self.option_inherits_attrs = True
return self._create_option(
name,
value,
label,
selected,
index,
subindex,
attrs={"style": "background: %s; color: #%s" % (label, font_color)},
)
import types
# from django.forms.widgets import Select
w.widget._create_option = w.widget.create_option # copy old method
w.widget.create_option = types.MethodType(
create_option_color, w.widget
) # replace old with new
w.widget.attrs = {
"onchange": "this.style.backgroundColor=this.options[this.selectedIndex].style."
"backgroundColor;this.style.color=this.options[this.selectedIndex].style.color"
}
def clean(self):
super().clean()
color_options = set()
if self.data.get("gradient", False) == "on":
for d in self.data:
if (
"displayvaluecoloroption_set-" in d
and d[
len("displayvaluecoloroption_set-") : len(
"displayvaluecoloroption_set-"
)
+ 1
].isdigit()
and "displayvaluecoloroption_set-"
+ d[
len("displayvaluecoloroption_set-") : len(
"displayvaluecoloroption_set-"
)
+ 1
]
+ "-DELETE"
not in self.data
):
color_options.update(
d[
len("displayvaluecoloroption_set-") : len(
"displayvaluecoloroption_set-"
)
+ 1
]
)
if len(color_options) > 1:
raise ValidationError("1 color option needed for gradient.")
if "displayvaluecoloroption_set-0-color_level" in self.data and float(
self.data["gradient_higher_level"]
) <= float(self.data.get("displayvaluecoloroption_set-0-color_level")):
raise ValidationError(
"gradient higher level must be strictly higher than the color option level."
)
if not len(color_options) == 1:
raise ValidationError("1 color option needed for gradient.")
if self.data.get("displayvaluecoloroption_set-0-color") == "":
raise ValidationError(
"Color for Display value color options cannot be null for gradient."
)
if self.data["color"] == "":
raise ValidationError("Color cannot be null for gradient.")
class Meta:
widgets = {
"gradient": forms.CheckboxInput(
attrs={
"--hideshow-fields": "gradient_higher_level,",
# gradient_higher_level visible if checkbox checked
"--show-on-checked": "gradient_higher_level,",
}
),
}
class Media:
js = ("pyscada/js/admin/hideshow.js",)
class DisplayValueColorOptionAdminFrom(forms.ModelForm):
def __init__(self, *args, **kwargs):
super(DisplayValueColorOptionAdminFrom, self).__init__(*args, **kwargs)
wtf = Color.objects.all()
w = self.fields["color"].widget
color_choices = [(None, None)]
for choice in wtf:
color_choices.append((choice.id, choice.color_code()))
w.choices = color_choices
def create_option_color(
self, name, value, label, selected, index, subindex=None, attrs=None
):
if label is None:
return self._create_option(
name, value, label, selected, index, subindex, attrs=None
)
font_color = hex(int("ffffff", 16) - int(label[1::], 16))[2::]
# attrs = self.build_attrs(attrs,{'style':'background: %s; color: #%s'%(label,font_color)})
self.option_inherits_attrs = True
return self._create_option(
name,
value,
label,
selected,
index,
subindex,
attrs={"style": "background: %s; color: #%s" % (label, font_color)},
)
import types
# from django.forms.widgets import Select
w.widget._create_option = w.widget.create_option # copy old method
w.widget.create_option = types.MethodType(
create_option_color, w.widget
) # replace old with new
w.widget.attrs = {
"onchange": "this.style.backgroundColor=this.options[this.selectedIndex].style."
"backgroundColor;this.style.color=this.options[this.selectedIndex].style.color"
}
class DisplayValueColorOptionInline(admin.TabularInline):
model = DisplayValueColorOption
form = DisplayValueColorOptionAdminFrom
extra = 0
class TransformDataAdmin(admin.ModelAdmin):
# only allow viewing and deleting
def has_module_permission(self, request):
return False
def has_add_permission(self, request):
return False
def has_change_permission(self, request, obj=None):
return False
def has_delete_permission(self, request, obj=None):
return True
class DisplayValueOptionTemplateAdmin(admin.ModelAdmin):
# only allow viewing and deleting
def has_module_permission(self, request):
return False
def has_add_permission(self, request):
return False
def has_change_permission(self, request, obj=None):
return False
def has_delete_permission(self, request, obj=None):
return True
class DisplayValueOptionAdmin(admin.ModelAdmin):
fieldsets = (
(
None,
{
"fields": (
"title",
"template",
"timestamp_conversion",
"transform_data",
"from_timestamp_offset",
),
},
),
(
"Color",
{
"fields": (
"color",
"color_only",
"gradient",
"gradient_higher_level",
),
},
),
)
form = DisplayValueOptionAdminFrom
save_as = True
save_as_continue = True
inlines = [DisplayValueColorOptionInline]
# Add inlines for any model with OneToOne relation with Device
related_models = [
field
for field in DisplayValueOption._meta.get_fields()
if issubclass(type(field), OneToOneRel)
]
for m in related_models:
model_dict = dict(model=m.related_model)
if hasattr(m.related_model, "FormSet"):
model_dict["formset"] = m.related_model.FormSet
cl = type(m.name, (admin.StackedInline,), model_dict) # classes=['collapse']
inlines.append(cl)
def has_module_permission(self, request):
return False
class Media:
js = (
# To be sure the jquery files are loaded before our js file
"admin/js/vendor/jquery/jquery.min.js",
"admin/js/jquery.init.js",
# only the inline corresponding to the transform data selected
"pyscada/js/admin/display_inline_transform_data_display_value_option.js",
)
class ControlElementOptionAdmin(admin.ModelAdmin):
save_as = True
save_as_continue = True
def has_module_permission(self, request):
return False
class ControlItemAdmin(admin.ModelAdmin):
list_display = (
"id",
"position",
"label",
"type",
"variable",
"variable_property",
"display_value_options",
"control_element_options",
)
list_filter = (
"controlpanel",
FormListFilter,
"type",
)
list_editable = (
"position",
"label",
"type",
"variable",
"variable_property",
"display_value_options",
"control_element_options",
)
raw_id_fields = ("variable",)
save_as = True
save_as_continue = True
class SlidingPanelMenuForm(forms.ModelForm):
def __init__(self, *args, **kwargs):
super(SlidingPanelMenuForm, self).__init__(*args, **kwargs)
wtf = ControlItem.objects.all()
w = self.fields["items"].widget
choices = []
for choice in wtf:
choices.append(
(
choice.id,
choice.label
+ " ("
+ choice.variable.name
+ ", "
+ choice.get_type_display()
+ ")",
)
)
w.choices = choices
class SlidingPanelMenuAdmin(admin.ModelAdmin):
# search_fields = ['name',]
# filter_horizontal = ('items',)
# form = SlidingPanelMenuForm
list_display = ("id", "title", "position", "visible")
save_as = True
save_as_continue = True
class WidgetAdmin(admin.ModelAdmin):
list_display_links = ("id",)
list_display = (
"id",
"title",
"page",
"row",
"col",
"size",
"content",
"visible",
"extra_css_class",
)
list_editable = (
"title",
"page",
"row",
"col",
"size",
"content",
"visible",
"extra_css_class",
)
list_filter = ("page",)
save_as = True
save_as_continue = True
class GroupDisplayPermissionForm(forms.ModelForm):
def clean(self):
super().clean()
hmi_group = self.cleaned_data.get("hmi_group", None)
id = self.instance.pk
unauthenticated_users = self.instance.unauthenticated_users
if len(
GroupDisplayPermission.objects.filter(hmi_group=hmi_group, unauthenticated_users=unauthenticated_users).exclude(id=id)
):
raise ValidationError("This group display permission already exist.")
class GroupDisplayPermissionAdmin(admin.ModelAdmin):
filter_horizontal = ()
save_as = True
save_as_continue = True
form = GroupDisplayPermissionForm
readonly_fields = ["unauthenticated_users"]
def get_fields(self, request, obj=None):
# show unauthenticated_users field only for the GroupDisplayPermission used for unauthenticated users and hide hmi_group
# show hmi_group field in other cases and hide the unauthenticated_users field
if obj is not None and obj.unauthenticated_users:
return ("unauthenticated_users",)
return ('hmi_group',)
def get_inlines(self, request, obj=None):
# Add inlines for any model with OneToOne relation with Device
items = [
field
for field in GroupDisplayPermission._meta.get_fields()
if issubclass(type(field), OneToOneRel)
]
inlines = []
for d in items:
filter_horizontal_inline = ()
for field in d.related_model._meta.local_many_to_many:
filter_horizontal_inline += (field.name,)
# Collapse inline only if empty
if hasattr(obj, d.name):
collapse = None
else:
collapse = ["collapse"]
device_dict = dict(
model=d.related_model,
filter_horizontal=filter_horizontal_inline,
classes=collapse,
)
cl = type(d.name, (admin.TabularInline,), device_dict)
inlines.append(cl)
return inlines
def has_delete_permission(self, request, obj=None):
if obj is not None and obj.hmi_group is None:
return False
return super().has_delete_permission(request, obj)
class ControlPanelAdmin(admin.ModelAdmin):
filter_horizontal = (
"items",
"forms",
)
save_as = True
save_as_continue = True
class ViewAdmin(admin.ModelAdmin):
filter_horizontal = ("pages", "sliding_panel_menus")
save_as = True
save_as_continue = True
class ExternalViewAdmin(admin.ModelAdmin):
save_as = True
save_as_continue = True
class CustomHTMLPanelAdmin(admin.ModelAdmin):
filter_horizontal = ("variables", "variable_properties")
save_as = True
save_as_continue = True
class PageAdmin(admin.ModelAdmin):
list_display_links = ("id",)
list_display = (
"id",
"title",
"link_title",
"position",
)
list_editable = (
"title",
"link_title",
"position",
)
list_filter = ("view__title",)
save_as = True
save_as_continue = True
class ProcessFlowDiagramItemAdmin(admin.ModelAdmin):
list_display = (
"id",
"control_item",
"top",
"left",
"width",
"height",
"visible",
"font_size",
)
list_editable = (
"control_item",
"top",
"left",
"width",
"height",
"visible",
"font_size",
)
# raw_id_fields = ('variable',)
save_as = True
save_as_continue = True
class ProcessFlowDiagramAdmin(admin.ModelAdmin):
list_display = (
"id",
"title",
"type",
"background_image",
)
list_editable = (
"title",
"type",
"background_image",
)
filter_horizontal = ("process_flow_diagram_items",)
save_as = True
save_as_continue = True
class ThemeForm(forms.ModelForm):
def clean(self):
super().clean()
try:
get_template(self.cleaned_data["base_filename"] + ".html").render()
except TemplateDoesNotExist as e:
raise ValidationError(f"Template {e} not found.")
try:
get_template(self.cleaned_data["view_filename"] + ".html").render(
{"base_html": self.cleaned_data.get("base_filename", "base") + ".html"}
)
except TemplateDoesNotExist as e:
raise ValidationError(f"Template {e} not found.")
class ThemeAdmin(admin.ModelAdmin):
save_as = True
save_as_continue = True
form = ThemeForm
def has_module_permission(self, request):
return False
class CssClassAdmin(admin.ModelAdmin):
save_as = True
save_as_continue = True
def has_module_permission(self, request):
return False
admin_site.register(ControlItem, ControlItemAdmin)
admin_site.register(Chart, ChartAdmin)
admin_site.register(Pie, PieAdmin)
admin_site.register(Form, FormAdmin)
admin_site.register(SlidingPanelMenu, SlidingPanelMenuAdmin)
admin_site.register(Page, PageAdmin)
admin_site.register(GroupDisplayPermission, GroupDisplayPermissionAdmin)
admin_site.register(DisplayValueOption, DisplayValueOptionAdmin)
admin_site.register(ControlElementOption, ControlElementOptionAdmin)
admin_site.register(ControlPanel, ControlPanelAdmin)
admin_site.register(CustomHTMLPanel, CustomHTMLPanelAdmin)
admin_site.register(Widget, WidgetAdmin)
admin_site.register(View, ViewAdmin)
admin_site.register(ExternalView, ExternalViewAdmin)
admin_site.register(ProcessFlowDiagram, ProcessFlowDiagramAdmin)
admin_site.register(ProcessFlowDiagramItem, ProcessFlowDiagramItemAdmin)
admin_site.register(Theme, ThemeAdmin)
admin_site.register(CssClass, CssClassAdmin)
admin_site.register(TransformData, TransformDataAdmin)
admin_site.register(DisplayValueOptionTemplate, DisplayValueOptionTemplateAdmin)
================================================
FILE: pyscada/hmi/apps.py
================================================
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.apps import AppConfig
from django.utils.translation import gettext_lazy as _
from django.db.utils import ProgrammingError, OperationalError
from django.conf import settings
import logging
logger = logging.getLogger(__name__)
class PyScadaHMIConfig(AppConfig):
name = "pyscada.hmi"
verbose_name = _("PyScada HMI")
default_auto_field = "django.db.models.AutoField"
def ready(self):
import pyscada.hmi.signals
def pyscada_app_init(self):
logger.debug("HMI init app")
try:
from .models import TransformData
# create the control item transform data display value options
# min, max, mean difference, difference percent...
# TODO: do not get the whole historical data for first, difference, difference percent
TransformData.objects.update_or_create(
short_name="Min",
defaults={
"inline_model_name": "TransformDataMin",
"js_function_name": "PyScadaControlItemDisplayValueTransformDataMin",
"js_files": "pyscada/js/pyscada/TransformDataHmiPlugin.js",
"need_historical_data": True,
},
)
TransformData.objects.update_or_create(
short_name="Max",
defaults={
"inline_model_name": "TransformDataMax",
"js_function_name": "PyScadaControlItemDisplayValueTransformDataMax",
"js_files": "pyscada/js/pyscada/TransformDataHmiPlugin.js",
"need_historical_data": True,
},
)
TransformData.objects.update_or_create(
short_name="Total",
defaults={
"inline_model_name": "TransformDataTotal",
"js_function_name": "PyScadaControlItemDisplayValueTransformDataTotal",
"js_files": "pyscada/js/pyscada/TransformDataHmiPlugin.js",
"need_historical_data": True,
},
)
TransformData.objects.update_or_create(
short_name="Difference",
defaults={
"inline_model_name": "TransformDataDifference",
"js_function_name": "PyScadaControlItemDisplayValueTransformDataDifference",
"js_files": "pyscada/js/pyscada/TransformDataHmiPlugin.js",
"need_historical_data": True,
},
)
TransformData.objects.update_or_create(
short_name="DifferencePercent",
defaults={
"inline_model_name": "TransformDataDifferencePercent",
"js_function_name": "PyScadaControlItemDisplayValueTransformDataDifferencePercent",
"js_files": "pyscada/js/pyscada/TransformDataHmiPlugin.js",
"need_historical_data": True,
},
)
TransformData.objects.update_or_create(
short_name="Delta",
defaults={
"inline_model_name": "TransformDataDelta",
"js_function_name": "PyScadaControlItemDisplayValueTransformDataDelta",
"js_files": "pyscada/js/pyscada/TransformDataHmiPlugin.js",
"need_historical_data": True,
},
)
TransformData.objects.update_or_create(
short_name="Mean",
defaults={
"inline_model_name": "TransformDataMean",
"js_function_name": "PyScadaControlItemDisplayValueTransformDataMean",
"js_files": "pyscada/js/pyscada/TransformDataHmiPlugin.js",
"need_historical_data": True,
},
)
TransformData.objects.update_or_create(
short_name="First",
defaults={
"inline_model_name": "TransformDataFirst",
"js_function_name": "PyScadaControlItemDisplayValueTransformDataFirst",
"js_files": "pyscada/js/pyscada/TransformDataHmiPlugin.js",
"need_historical_data": True,
},
)
TransformData.objects.update_or_create(
short_name="Count",
defaults={
"inline_model_name": "TransformDataCount",
"js_function_name": "PyScadaControlItemDisplayValueTransformDataCount",
"js_files": "pyscada/js/pyscada/TransformDataHmiPlugin.js",
"need_historical_data": True,
},
)
TransformData.objects.update_or_create(
short_name="CountValue",
defaults={
"inline_model_name": "TransformDataCountValue",
"js_function_name": "PyScadaControlItemDisplayValueTransformDataCountValue",
"js_files": "pyscada/js/pyscada/TransformDataHmiPlugin.js",
"need_historical_data": True,
},
)
TransformData.objects.update_or_create(
short_name="Range",
defaults={
"inline_model_name": "TransformDataRange",
"js_function_name": "PyScadaControlItemDisplayValueTransformDataRange",
"js_files": "pyscada/js/pyscada/TransformDataHmiPlugin.js",
"need_historical_data": True,
},
)
TransformData.objects.update_or_create(
short_name="Step",
defaults={
"inline_model_name": "TransformDataStep",
"js_function_name": "PyScadaControlItemDisplayValueTransformDataStep",
"js_files": "pyscada/js/pyscada/TransformDataHmiPlugin.js",
"need_historical_data": True,
},
)
TransformData.objects.update_or_create(
short_name="ChangeCount",
defaults={
"inline_model_name": "TransformDataChangeCount",
"js_function_name": "PyScadaControlItemDisplayValueTransformDataChangeCount",
"js_files": "pyscada/js/pyscada/TransformDataHmiPlugin.js",
"need_historical_data": True,
},
)
TransformData.objects.update_or_create(
short_name="DistinctCount",
defaults={
"inline_model_name": "TransformDataDistinctCount",
"js_function_name": "PyScadaControlItemDisplayValueTransformDataDistinctCount",
"js_files": "pyscada/js/pyscada/TransformDataHmiPlugin.js",
"need_historical_data": True,
},
)
except (ProgrammingError, OperationalError) as e:
logger.debug(e)
try:
from .models import DisplayValueOptionTemplate
STATIC_URL = (
str(settings.STATIC_URL)
if hasattr(settings, "STATIC_URL")
else "/static/"
)
# create the circular gauge for control item display value option
DisplayValueOptionTemplate.objects.update_or_create(
label="Circular gauge",
defaults={
"template_name": "circular_gauge.html",
"js_files": "pyscada/js/jquery/jquery.tablesorter.min.js,"
+ "pyscada/js/jquery/parser-input-select.js,"
+ "pyscada/js/flot/lib/jquery.mousewheel.js,"
+ "pyscada/js/flot/source/jquery.canvaswrapper.js,"
+ "pyscada/js/flot/source/jquery.colorhelpers.js,"
+ "pyscada/js/flot/source/jquery.flot.js,"
+ "pyscada/js/flot/source/jquery.flot.saturated.js,"
+ "pyscada/js/flot/source/jquery.flot.browser.js,"
+ "pyscada/js/flot/source/jquery.flot.drawSeries.js,"
+ "pyscada/js/flot/source/jquery.flot.errorbars.js,"
+ "pyscada/js/flot/source/jquery.flot.uiConstants.js,"
+ "pyscada/js/flot/source/jquery.flot.logaxis.js,"
+ "pyscada/js/flot/source/jquery.flot.symbol.js,"
+ "pyscada/js/flot/source/jquery.flot.flatdata.js,"
+ "pyscada/js/flot/source/jquery.flot.navigate.js,"
+ "pyscada/js/flot/source/jquery.flot.fillbetween.js,"
+ "pyscada/js/flot/source/jquery.flot.stack.js,"
+ "pyscada/js/flot/source/jquery.flot.touchNavigate.js,"
+ "pyscada/js/flot/source/jquery.flot.hover.js,"
+ "pyscada/js/flot/source/jquery.flot.touch.js,"
+ "pyscada/js/flot/source/jquery.flot.time.js,"
+ "pyscada/js/flot/source/jquery.flot.axislabels.js,"
+ "pyscada/js/flot/source/jquery.flot.selection.js,"
+ "pyscada/js/flot/source/jquery.flot.composeImages.js,"
+ "pyscada/js/flot/source/jquery.flot.legend.js,"
+ "pyscada/js/flot/source/jquery.flot.pie.js,"
+ "pyscada/js/flot/source/jquery.flot.crosshair.js,"
+ "pyscada/js/flot/source/jquery.flot.gauge.js,"
+ "pyscada/js/jquery.flot.axisvalues.js",
},
)
except (ProgrammingError, OperationalError) as e:
logger.debug(e)
================================================
FILE: pyscada/hmi/migrations/0001_initial.py
================================================
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
("pyscada", "0001_initial"),
("auth", "0001_initial"),
]
operations = [
migrations.CreateModel(
name="Chart",
fields=[
("id", models.AutoField(serialize=False, primary_key=True)),
("title", models.CharField(default="", max_length=400)),
(
"x_axis_label",
models.CharField(default="", max_length=400, blank=True),
),
("x_axis_ticks", models.PositiveSmallIntegerField(default=6)),
(
"y_axis_label",
models.CharField(default="", max_length=400, blank=True),
),
("y_axis_min", models.FloatField(default=0)),
("y_axis_max", models.FloatField(default=100)),
("variables", models.ManyToManyField(to="pyscada.Variable")),
],
options={},
bases=(models.Model,),
),
migrations.CreateModel(
name="ChartSet",
fields=[
("id", models.AutoField(serialize=False, primary_key=True)),
(
"distribution",
models.PositiveSmallIntegerField(
default=0,
choices=[
(0, "side by side (1/2)"),
(1, "side by side (2/3|1/3)"),
(2, "side by side (1/3|2/3)"),
],
),
),
(
"chart_1",
models.ForeignKey(
related_name="chart_1",
verbose_name="left Chart",
blank=True,
to="hmi.Chart",
null=True,
on_delete=models.SET_NULL,
),
),
(
"chart_2",
models.ForeignKey(
related_name="chart_2",
verbose_name="right Chart",
blank=True,
to="hmi.Chart",
null=True,
on_delete=models.SET_NULL,
),
),
],
options={},
bases=(models.Model,),
),
migrations.CreateModel(
name="Color",
fields=[
("id", models.AutoField(serialize=False, primary_key=True)),
("name", models.SlugField(max_length=80, verbose_name="variable name")),
("R", models.PositiveSmallIntegerField(default=0)),
("G", models.PositiveSmallIntegerField(default=0)),
("B", models.PositiveSmallIntegerField(default=0)),
],
options={},
bases=(models.Model,),
),
migrations.CreateModel(
name="ControlItem",
fields=[
("id", models.AutoField(serialize=False, primary_key=True)),
("label", models.CharField(default="", max_length=400)),
("position", models.PositiveSmallIntegerField(default=0)),
(
"type",
models.PositiveSmallIntegerField(
default=0,
choices=[
(0, "label blue"),
(1, "label light blue"),
(2, "label ok"),
(3, "label warning"),
(4, "label alarm"),
(7, "label alarm inverted"),
(5, "Control Element"),
(6, "Display Value"),
],
),
),
(
"variable",
models.ForeignKey(
on_delete=django.db.models.deletion.SET_NULL,
to="pyscada.Variable",
null=True,
),
),
],
options={
"ordering": ["position"],
},
bases=(models.Model,),
),
migrations.CreateModel(
name="ControlPanel",
fields=[
("id", models.AutoField(serialize=False, primary_key=True)),
("title", models.CharField(default="", max_length=400)),
("items", models.ManyToManyField(to="hmi.ControlItem", blank=True)),
],
options={},
bases=(models.Model,),
),
migrations.CreateModel(
name="CustomHTMLPanel",
fields=[
("id", models.AutoField(serialize=False, primary_key=True)),
("title", models.CharField(default="", max_length=400, blank=True)),
("html", models.TextField()),
("variables", models.ManyToManyField(to="pyscada.Variable")),
],
options={},
bases=(models.Model,),
),
migrations.CreateModel(
name="GroupDisplayPermission",
fields=[
(
"id",
models.AutoField(
verbose_name="ID",
serialize=False,
auto_created=True,
primary_key=True,
),
),
("charts", models.ManyToManyField(to="hmi.Chart", blank=True)),
(
"control_items",
models.ManyToManyField(to="hmi.ControlItem", blank=True),
),
(
"custom_html_panels",
models.ManyToManyField(to="hmi.CustomHTMLPanel", blank=True),
),
(
"hmi_group",
models.OneToOneField(to="auth.Group", on_delete=models.SET_NULL),
),
],
options={},
bases=(models.Model,),
),
migrations.CreateModel(
name="HMIVariable",
fields=[
(
"id",
models.AutoField(
verbose_name="ID",
serialize=False,
auto_created=True,
primary_key=True,
),
),
(
"short_name",
models.CharField(
default="", max_length=80, verbose_name="variable short name"
),
),
(
"chart_line_thickness",
models.PositiveSmallIntegerField(default=3, choices=[(3, "3Px")]),
),
(
"chart_line_color",
models.ForeignKey(
on_delete=django.db.models.deletion.SET_NULL,
default=None,
to="hmi.Color",
null=True,
),
),
(
"hmi_variable",
models.OneToOneField(
to="pyscada.Variable", on_delete=models.SET_NULL
),
),
],
options={},
bases=(models.Model,),
),
migrations.CreateModel(
name="Page",
fields=[
("id", models.AutoField(serialize=False, primary_key=True)),
("title", models.CharField(default="", max_length=400)),
("link_title", models.SlugField(default="", max_length=80)),
("position", models.PositiveSmallIntegerField(default=0)),
],
options={
"ordering": ["position"],
},
bases=(models.Model,),
),
migrations.CreateModel(
name="SlidingPanelMenu",
fields=[
("id", models.AutoField(serialize=False, primary_key=True)),
("title", models.CharField(default="", max_length=400)),
(
"position",
models.PositiveSmallIntegerField(
default=0,
choices=[(0, "Control Menu"), (1, "left"), (2, "right")],
),
),
("visable", models.BooleanField(default=True)),
(
"control_panel",
models.ForeignKey(
default=None,
blank=True,
to="hmi.ControlPanel",
null=True,
on_delete=models.SET_NULL,
),
),
],
options={},
bases=(models.Model,),
),
migrations.CreateModel(
name="View",
fields=[
("id", models.AutoField(serialize=False, primary_key=True)),
("title", models.CharField(default="", max_length=400)),
(
"description",
models.TextField(default="", null=True, verbose_name="Description"),
),
("link_title", models.SlugField(default="", max_length=80)),
(
"logo",
models.ImageField(
upload_to="img/", verbose_name="Overview Picture", blank=True
),
),
("visable", models.BooleanField(default=True)),
("position", models.PositiveSmallIntegerField(default=0)),
("pages", models.ManyToManyField(to="hmi.Page")),
(
"sliding_panel_menus",
models.ManyToManyField(to="hmi.SlidingPanelMenu", blank=True),
),
],
options={
"ordering": ["position"],
},
bases=(models.Model,),
),
migrations.CreateModel(
name="Widget",
fields=[
("id", models.AutoField(serialize=False, primary_key=True)),
("title", models.CharField(default="", max_length=400, blank=True)),
(
"row",
models.PositiveSmallIntegerField(
default=0,
choices=[
(0, "1. row"),
(1, "2. row"),
(2, "3. row"),
(3, "4. row"),
(4, "5. row"),
(5, "6. row"),
(6, "7. row"),
(7, "8. row"),
(8, "9. row"),
(9, "10. row"),
(10, "11. row"),
(11, "12. row"),
],
),
),
(
"col",
models.PositiveSmallIntegerField(
default=0,
choices=[
(0, "1. col"),
(1, "2. col"),
(2, "3. col"),
(3, "4. col"),
],
),
),
(
"size",
models.PositiveSmallIntegerField(
default=4,
choices=[
(4, "page width"),
(3, "3/4 page width"),
(2, "1/2 page width"),
(1, "1/4 page width"),
],
),
),
("visable", models.BooleanField(default=True)),
(
"chart",
models.ForeignKey(
default=None,
blank=True,
to="hmi.Chart",
null=True,
on_delete=models.SET_NULL,
),
),
(
"chart_set",
models.ForeignKey(
default=None,
blank=True,
to="hmi.ChartSet",
null=True,
on_delete=models.SET_NULL,
),
),
(
"control_panel",
models.ForeignKey(
default=None,
blank=True,
to="hmi.ControlPanel",
null=True,
on_delete=models.SET_NULL,
),
),
(
"custom_html_panel",
models.ForeignKey(
default=None,
blank=True,
to="hmi.CustomHTMLPanel",
null=True,
on_delete=models.SET_NULL,
),
),
(
"page",
models.ForeignKey(
on_delete=django.db.models.deletion.SET_NULL,
default=None,
to="hmi.Page",
null=True,
),
),
],
options={
"ordering": ["row", "col"],
},
bases=(models.Model,),
),
migrations.AddField(
model_name="groupdisplaypermission",
name="pages",
field=models.ManyToManyField(to="hmi.Page", blank=True),
preserve_default=True,
),
migrations.AddField(
model_name="groupdisplaypermission",
name="sliding_panel_menus",
field=models.ManyToManyField(to="hmi.SlidingPanelMenu", blank=True),
preserve_default=True,
),
migrations.AddField(
model_name="groupdisplaypermission",
name="views",
field=models.ManyToManyField(to="hmi.View", blank=True),
preserve_default=True,
),
migrations.AddField(
model_name="groupdisplaypermission",
name="widgets",
field=models.ManyToManyField(to="hmi.Widget", blank=True),
preserve_default=True,
),
]
================================================
FILE: pyscada/hmi/migrations/0002_auto_20151016_1932.py
================================================
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
("pyscada", "0002_event_hysteresis"),
("hmi", "0001_initial"),
]
operations = [
migrations.CreateModel(
name="ProcessFlowDiagram",
fields=[
("id", models.AutoField(serialize=False, primary_key=True)),
("title", models.CharField(default="", max_length=400, blank=True)),
(
"background_image",
models.ImageField(
upload_to="img/", verbose_name="background image", blank=True
),
),
],
options={},
bases=(models.Model,),
),
migrations.CreateModel(
name="ProcessFlowDiagramItem",
fields=[
("id", models.AutoField(serialize=False, primary_key=True)),
("label", models.CharField(default="", max_length=400, blank=True)),
(
"type",
models.PositiveSmallIntegerField(
default=0,
choices=[
(0, "label blue"),
(1, "label light blue"),
(2, "label ok"),
(3, "label warning"),
(4, "label alarm"),
(7, "label alarm inverted"),
(5, "Control Element"),
(6, "Display Value"),
],
),
),
("top", models.PositiveIntegerField(default=0)),
("left", models.PositiveIntegerField(default=0)),
("width", models.PositiveIntegerField(default=0)),
("height", models.PositiveIntegerField(default=0)),
("visible", models.BooleanField(default=True)),
(
"variable",
models.ForeignKey(
default=None, to="pyscada.Variable", on_delete=models.SET_NULL
),
),
],
options={},
bases=(models.Model,),
),
migrations.AddField(
model_name="processflowdiagram",
name="process_flow_diagram_items",
field=models.ManyToManyField(to="hmi.ProcessFlowDiagramItem", blank=True),
preserve_default=True,
),
migrations.AddField(
model_name="groupdisplaypermission",
name="process_flow_diagram",
field=models.ManyToManyField(to="hmi.ProcessFlowDiagram", blank=True),
preserve_default=True,
),
migrations.AddField(
model_name="widget",
name="process_flow_diagram",
field=models.ForeignKey(
default=None,
blank=True,
to="hmi.ProcessFlowDiagram",
null=True,
on_delete=models.SET_NULL,
),
preserve_default=True,
),
]
================================================
FILE: pyscada/hmi/migrations/0003_auto_20151130_1456.py
================================================
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("hmi", "0002_auto_20151016_1932"),
]
operations = [
migrations.AlterField(
model_name="controlitem",
name="variable",
field=models.ForeignKey(
to="pyscada.Variable", default=1, null=True, on_delete=models.SET_NULL
),
),
# migrations.AlterField(
# model_name='hmivariable',
# name='chart_line_color',
# field=models.ForeignKey(on_delete=models.SET(1), default=1, to='hmi.Color', null=True),
# ),
# migrations.AlterField(
# model_name='widget',
# name='page',
# field=models.ForeignKey(default=1, to='hmi.Page'),
# preserve_default=False,
# ),
]
================================================
FILE: pyscada/hmi/migrations/0004_auto_20151130_1502.py
================================================
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("hmi", "0003_auto_20151130_1456"),
]
operations = [
migrations.AlterField(
model_name="controlitem",
name="variable",
field=models.ForeignKey(
to="pyscada.Variable", null=True, on_delete=models.SET_NULL
),
),
# migrations.AlterField(
# model_name='hmivariable',
# name='chart_line_color',
# field=models.ForeignKey(on_delete=models.SET(1), default=1, to='hmi.Color', null=True),
# ),
# migrations.AlterField(
# model_name='widget',
# name='page',
# field=models.ForeignKey(default=1, to='hmi.Page'),
# preserve_default=False,
# ),
]
================================================
FILE: pyscada/hmi/migrations/0005_auto_20160111_1822.py
================================================
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
("hmi", "0004_auto_20151130_1502"),
]
operations = [
migrations.AlterField(
model_name="processflowdiagramitem",
name="variable",
field=models.ForeignKey(
default=None,
blank=True,
to="pyscada.Variable",
null=True,
on_delete=models.SET_NULL,
),
),
]
================================================
FILE: pyscada/hmi/migrations/0006_auto_20160111_1848.py
================================================
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("hmi", "0005_auto_20160111_1822"),
]
operations = [
migrations.AlterField(
model_name="hmivariable",
name="chart_line_color",
field=models.ForeignKey(
default=None,
blank=True,
to="hmi.Color",
null=True,
on_delete=models.SET_NULL,
),
),
migrations.AlterField(
model_name="widget",
name="page",
field=models.ForeignKey(
default=None,
blank=True,
to="hmi.Page",
null=True,
on_delete=models.SET_NULL,
),
),
]
================================================
FILE: pyscada/hmi/migrations/0007_auto_20160518_0848.py
================================================
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("hmi", "0006_auto_20160111_1848"),
]
operations = [
migrations.RemoveField(
model_name="chartset",
name="chart_1",
),
migrations.RemoveField(
model_name="chartset",
name="chart_2",
),
migrations.RemoveField(
model_name="hmivariable",
name="chart_line_color",
),
migrations.RemoveField(
model_name="hmivariable",
name="hmi_variable",
),
migrations.RemoveField(
model_name="widget",
name="chart_set",
),
migrations.DeleteModel(
name="ChartSet",
),
migrations.DeleteModel(
name="Color",
),
migrations.DeleteModel(
name="HMIVariable",
),
]
================================================
FILE: pyscada/hmi/migrations/0008_auto_20180620_0716.py
================================================
# -*- coding: utf-8 -*-
# Generated by Django 1.11.4 on 2018-06-20 07:16
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("hmi", "0007_auto_20160518_0848"),
]
operations = [
migrations.AlterField(
model_name="processflowdiagramitem",
name="height",
field=models.PositiveIntegerField(blank=True, default=0),
),
migrations.AlterField(
model_name="processflowdiagramitem",
name="left",
field=models.PositiveIntegerField(blank=True, default=0),
),
migrations.AlterField(
model_name="processflowdiagramitem",
name="top",
field=models.PositiveIntegerField(blank=True, default=0),
),
migrations.AlterField(
model_name="processflowdiagramitem",
name="width",
field=models.PositiveIntegerField(blank=True, default=0),
),
]
================================================
FILE: pyscada/hmi/migrations/0009_controlitem_property_name.py
================================================
# -*- coding: utf-8 -*-
# Generated by Django 1.11.13 on 2018-06-29 10:15
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("hmi", "0008_auto_20180620_0716"),
]
operations = [
migrations.AddField(
model_name="controlitem",
name="property_name",
field=models.CharField(blank=True, default="", max_length=255),
),
]
================================================
FILE: pyscada/hmi/migrations/0010_auto_20180705_1341.py
================================================
# -*- coding: utf-8 -*-
# Generated by Django 1.11.13 on 2018-07-05 13:41
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
("pyscada", "0045_auto_20180705_1341"),
("hmi", "0009_controlitem_property_name"),
]
operations = [
migrations.RemoveField(
model_name="controlitem",
name="property_name",
),
migrations.AddField(
model_name="controlitem",
name="variable_property",
field=models.ForeignKey(
null=True,
on_delete=django.db.models.deletion.CASCADE,
to="pyscada.VariableProperty",
),
),
]
================================================
FILE: pyscada/hmi/migrations/0011_auto_20180710_1549.py
================================================
# -*- coding: utf-8 -*-
# Generated by Django 1.11.13 on 2018-07-10 15:49
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
("hmi", "0010_auto_20180705_1341"),
]
operations = [
migrations.AlterField(
model_name="controlitem",
name="variable",
field=models.ForeignKey(
blank=True,
null=True,
on_delete=django.db.models.deletion.CASCADE,
to="pyscada.Variable",
),
),
migrations.AlterField(
model_name="controlitem",
name="variable_property",
field=models.ForeignKey(
blank=True,
null=True,
on_delete=django.db.models.deletion.CASCADE,
to="pyscada.VariableProperty",
),
),
]
================================================
FILE: pyscada/hmi/migrations/0012_auto_20180912_1302.py
================================================
# -*- coding: utf-8 -*-
# Generated by Django 1.11.11 on 2018-09-12 13:02
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
("hmi", "0011_auto_20180710_1549"),
]
operations = [
migrations.CreateModel(
name="WidgetContent",
fields=[
(
"id",
models.AutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
("content_model", models.CharField(max_length=400)),
("content_pk", models.PositiveIntegerField()),
],
),
migrations.RenameField(
model_name="slidingpanelmenu",
old_name="visable",
new_name="visible",
),
migrations.RenameField(
model_name="view",
old_name="visable",
new_name="visible",
),
migrations.RenameField(
model_name="widget",
old_name="visable",
new_name="visible",
),
migrations.AddField(
model_name="widget",
name="content",
field=models.ForeignKey(
default=None,
null=True,
on_delete=django.db.models.deletion.CASCADE,
to="hmi.WidgetContent",
),
),
]
================================================
FILE: pyscada/hmi/migrations/0013_widget_update_20180912_1315.py
================================================
# -*- coding: utf-8 -*-
# Generated by Django 1.11.11 on 2018-09-12 13:02
from __future__ import unicode_literals
from django.db import migrations
def forwards_func(apps, schema_editor):
# We get the model from the versioned app registry;
# if we directly import it, it'll be the wrong version
Chart = apps.get_model("hmi", "Chart")
ProcessFlowDiagram = apps.get_model("hmi", "ProcessFlowDiagram")
CustomHTMLPanel = apps.get_model("hmi", "CustomHTMLPanel")
ControlPanel = apps.get_model("hmi", "ControlPanel")
Widget = apps.get_model("hmi", "Widget")
WidgetContent = apps.get_model("hmi", "WidgetContent")
for c in Chart.objects.using(schema_editor.connection.alias).all():
wc = WidgetContent(content_pk=c.pk, content_model="pyscada.hmi.models.Chart")
wc.save()
for c in ProcessFlowDiagram.objects.using(schema_editor.connection.alias).all():
wc = WidgetContent(
content_pk=c.pk, content_model="pyscada.hmi.models.ProcessFlowDiagram"
)
wc.save()
for c in CustomHTMLPanel.objects.using(schema_editor.connection.alias).all():
wc = WidgetContent(
content_pk=c.pk, content_model="pyscada.hmi.models.CustomHTMLPanel"
)
wc.save()
for c in ControlPanel.objects.using(schema_editor.connection.alias).all():
wc = WidgetContent(
content_pk=c.pk, content_model="pyscada.hmi.models.ControlPanel"
)
wc.save()
for w in Widget.objects.using(schema_editor.connection.alias).all():
if w.chart is not None:
content = (
WidgetContent.objects.using(schema_editor.connection.alias)
.filter(content_pk=w.chart.pk, content_model="pyscada.hmi.models.Chart")
.first()
)
if content is None:
continue
elif w.control_panel is not None:
content = (
WidgetContent.objects.using(schema_editor.connection.alias)
.filter(
content_pk=w.control_panel.pk,
content_model="pyscada.hmi.models.ControlPanel",
)
.first()
)
if content is None:
continue
elif w.custom_html_panel is not None:
content = (
WidgetContent.objects.using(schema_editor.connection.alias)
.filter(
content_pk=w.custom_html_panel.pk,
content_model="pyscada.hmi.models.CustomHTMLPanel",
)
.first()
)
if content is None:
continue
elif w.process_flow_diagram is not None:
content = (
WidgetContent.objects.using(schema_editor.connection.alias)
.filter(
content_pk=w.process_flow_diagram.pk,
content_model="pyscada.hmi.models.ProcessFlowDiagram",
)
.first()
)
if content is None:
continue
else:
continue
w.content = content
w.save()
class Migration(migrations.Migration):
dependencies = [
("hmi", "0012_auto_20180912_1302"),
]
operations = [
migrations.RunPython(forwards_func, reverse_code=migrations.RunPython.noop),
]
================================================
FILE: pyscada/hmi/migrations/0014_auto_20180912_1340.py
================================================
# -*- coding: utf-8 -*-
# Generated by Django 1.11.11 on 2018-09-12 13:40
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("hmi", "0013_widget_update_20180912_1315"),
]
operations = [
migrations.RemoveField(
model_name="widget",
name="chart",
),
migrations.RemoveField(
model_name="widget",
name="control_panel",
),
migrations.RemoveField(
model_name="widget",
name="custom_html_panel",
),
migrations.RemoveField(
model_name="widget",
name="process_flow_diagram",
),
]
================================================
FILE: pyscada/hmi/migrations/0015_auto_20180913_1608.py
================================================
# -*- coding: utf-8 -*-
# Generated by Django 1.11.14 on 2018-09-13 16:08
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
("pyscada", "0047_variableproperty_unit"),
("hmi", "0014_auto_20180912_1340"),
]
operations = [
migrations.CreateModel(
name="Form",
fields=[
("id", models.AutoField(primary_key=True, serialize=False)),
("title", models.CharField(default="", max_length=400)),
("button", models.CharField(default="Ok", max_length=50)),
(
"control_items",
models.ManyToManyField(
related_name="control_items_form", to="hmi.ControlItem"
),
),
(
"hidden_control_items_to_true",
models.ManyToManyField(
related_name="hidden_control_items_form", to="hmi.ControlItem"
),
),
],
),
migrations.CreateModel(
name="XYChart",
fields=[
("id", models.AutoField(primary_key=True, serialize=False)),
("title", models.CharField(default="", max_length=400)),
(
"x_axis_label",
models.CharField(blank=True, default="", max_length=400),
),
(
"x_axis_linlog",
models.BooleanField(
default=False, help_text="False->Lin / True->Log"
),
),
(
"y_axis_label",
models.CharField(blank=True, default="", max_length=400),
),
(
"variables",
models.ManyToManyField(
related_name="variables_xy_chart", to="pyscada.Variable"
),
),
(
"x_axis_var",
models.ForeignKey(
default=None,
on_delete=django.db.models.deletion.CASCADE,
related_name="x_axis_var",
to="pyscada.Variable",
),
),
],
options={
"abstract": False,
},
),
migrations.AddField(
model_name="view",
name="show_timeline",
field=models.BooleanField(default=True),
),
migrations.AddField(
model_name="controlpanel",
name="forms",
field=models.ManyToManyField(blank=True, to="hmi.Form"),
),
migrations.AddField(
model_name="groupdisplaypermission",
name="xy_charts",
field=models.ManyToManyField(blank=True, to="hmi.XYChart"),
),
]
================================================
FILE: pyscada/hmi/migrations/0016_auto_20181004_0831.py
================================================
# -*- coding: utf-8 -*-
# Generated by Django 1.11.14 on 2018-10-04 08:31
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("hmi", "0015_auto_20180913_1608"),
]
operations = [
migrations.AddField(
model_name="xychart",
name="y_axis_plotpoints",
field=models.BooleanField(default=False, help_text="Show the plots points"),
),
migrations.AddField(
model_name="xychart",
name="y_axis_uniquescale",
field=models.BooleanField(
default=True, help_text="To have a unique scale for all the y axis"
),
),
migrations.AlterField(
model_name="form",
name="control_items",
field=models.ManyToManyField(
blank=True, related_name="control_items_form", to="hmi.ControlItem"
),
),
migrations.AlterField(
model_name="form",
name="hidden_control_items_to_true",
field=models.ManyToManyField(
blank=True,
related_name="hidden_control_items_form",
to="hmi.ControlItem",
),
),
]
================================================
FILE: pyscada/hmi/migrations/0017_groupdisplaypermission_forms.py
================================================
# -*- coding: utf-8 -*-
# Generated by Django 1.11.14 on 2018-10-26 06:30
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("hmi", "0016_auto_20181004_0831"),
]
operations = [
migrations.AddField(
model_name="groupdisplaypermission",
name="forms",
field=models.ManyToManyField(blank=True, to="hmi.Form"),
),
]
================================================
FILE: pyscada/hmi/migrations/0018_auto_20181205_0937.py
================================================
# -*- coding: utf-8 -*-
# Generated by Django 1.11.14 on 2018-12-05 09:37
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("hmi", "0017_groupdisplaypermission_forms"),
]
operations = [
migrations.CreateModel(
name="DropDown",
fields=[
("id", models.AutoField(primary_key=True, serialize=False)),
("title", models.CharField(default="", max_length=400)),
("empty", models.BooleanField(default=False)),
("empty_value", models.CharField(default="------", max_length=30)),
],
),
migrations.CreateModel(
name="DropDownItem",
fields=[
("id", models.AutoField(primary_key=True, serialize=False)),
("title", models.CharField(default="", max_length=400)),
],
),
migrations.AddField(
model_name="dropdown",
name="items",
field=models.ManyToManyField(to="hmi.DropDownItem"),
),
migrations.AddField(
model_name="controlpanel",
name="dropdowns",
field=models.ManyToManyField(blank=True, to="hmi.DropDown"),
),
migrations.AddField(
model_name="form",
name="dropdowns",
field=models.ManyToManyField(
blank=True, related_name="dropdowns_form", to="hmi.DropDown"
),
),
migrations.AddField(
model_name="groupdisplaypermission",
name="dropdowns",
field=models.ManyToManyField(blank=True, to="hmi.DropDown"),
),
]
================================================
FILE: pyscada/hmi/migrations/0019_auto_20181205_1058.py
================================================
# -*- coding: utf-8 -*-
# Generated by Django 1.11.14 on 2018-12-05 10:58
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
("pyscada", "0050_merge_20181130_1143"),
("hmi", "0018_auto_20181205_0937"),
]
operations = [
migrations.AddField(
model_name="dropdown",
name="variable",
field=models.ForeignKey(
blank=True,
null=True,
on_delete=django.db.models.deletion.CASCADE,
to="pyscada.Variable",
),
),
migrations.AddField(
model_name="dropdown",
name="variable_property",
field=models.ForeignKey(
blank=True,
null=True,
on_delete=django.db.models.deletion.CASCADE,
to="pyscada.VariableProperty",
),
),
]
================================================
FILE: pyscada/hmi/migrations/0020_pie.py
================================================
# -*- coding: utf-8 -*-
# Generated by Django 1.11.18 on 2019-05-15 12:32
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("pyscada", "0054_auto_20190411_0749"),
("hmi", "0019_auto_20181205_1058"),
]
operations = [
migrations.CreateModel(
name="Pie",
fields=[
("id", models.AutoField(primary_key=True, serialize=False)),
("title", models.CharField(default="", max_length=400)),
(
"radius",
models.CharField(
default="auto",
help_text="auto or between 0 and 1 or value in pixel",
max_length=10,
),
),
(
"innerRadius",
models.PositiveSmallIntegerField(
default=0, help_text="between 0 and 1 or value in pixel"
),
),
("variables", models.ManyToManyField(to="pyscada.Variable")),
],
options={
"abstract": False,
},
),
]
================================================
FILE: pyscada/hmi/migrations/0021_auto_20190528_0924.py
================================================
# -*- coding: utf-8 -*-
# Generated by Django 1.11.18 on 2019-05-28 09:24
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("pyscada", "0054_auto_20190411_0749"),
("hmi", "0020_pie"),
]
operations = [
migrations.AddField(
model_name="customhtmlpanel",
name="variable_properties",
field=models.ManyToManyField(blank=True, to="pyscada.VariableProperty"),
),
migrations.AlterField(
model_name="customhtmlpanel",
name="variables",
field=models.ManyToManyField(blank=True, to="pyscada.Variable"),
),
]
================================================
FILE: pyscada/hmi/migrations/0022_auto_20191004_0912.py
================================================
# Generated by Django 2.2.6 on 2019-10-04 09:12
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
("hmi", "0021_auto_20190528_0924"),
]
operations = [
migrations.AlterField(
model_name="controlitem",
name="variable",
field=models.ForeignKey(
blank=True,
null=True,
on_delete=django.db.models.deletion.SET_NULL,
to="pyscada.Variable",
),
),
migrations.AlterField(
model_name="controlitem",
name="variable_property",
field=models.ForeignKey(
blank=True,
null=True,
on_delete=django.db.models.deletion.SET_NULL,
to="pyscada.VariableProperty",
),
),
migrations.AlterField(
model_name="dropdown",
name="variable",
field=models.ForeignKey(
blank=True,
null=True,
on_delete=django.db.models.deletion.SET_NULL,
to="pyscada.Variable",
),
),
migrations.AlterField(
model_name="dropdown",
name="variable_property",
field=models.ForeignKey(
blank=True,
null=True,
on_delete=django.db.models.deletion.SET_NULL,
to="pyscada.VariableProperty",
),
),
migrations.AlterField(
model_name="form",
name="control_items",
field=models.ManyToManyField(
blank=True,
limit_choices_to={"type": "5"},
related_name="control_items_form",
to="hmi.ControlItem",
),
),
migrations.AlterField(
model_name="form",
name="hidden_control_items_to_true",
field=models.ManyToManyField(
blank=True,
limit_choices_to={"type": "5"},
related_name="hidden_control_items_form",
to="hmi.ControlItem",
),
),
migrations.AlterField(
model_name="groupdisplaypermission",
name="hmi_group",
field=models.OneToOneField(
null=True, on_delete=django.db.models.deletion.SET_NULL, to="auth.Group"
),
),
migrations.AlterField(
model_name="widget",
name="content",
field=models.ForeignKey(
default=None,
null=True,
on_delete=django.db.models.deletion.SET_NULL,
to="hmi.WidgetContent",
),
),
migrations.AlterField(
model_name="xychart",
name="x_axis_var",
field=models.ForeignKey(
default=None,
null=True,
on_delete=django.db.models.deletion.SET_NULL,
related_name="x_axis_var",
to="pyscada.Variable",
),
),
]
================================================
FILE: pyscada/hmi/migrations/0023_dropdownitem_value.py
================================================
# Generated by Django 2.2.7 on 2019-11-13 16:41
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("hmi", "0022_auto_20191004_0912"),
]
operations = [
migrations.AddField(
model_name="dropdownitem",
name="value",
field=models.CharField(default="", max_length=400),
),
]
================================================
FILE: pyscada/hmi/migrations/0024_auto_20191212_1516.py
================================================
# Generated by Django 2.2.8 on 2019-12-12 15:16
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
("hmi", "0023_dropdownitem_value"),
]
operations = [
migrations.AlterField(
model_name="controlitem",
name="variable",
field=models.ForeignKey(
blank=True,
null=True,
on_delete=django.db.models.deletion.CASCADE,
to="pyscada.Variable",
),
),
migrations.AlterField(
model_name="controlitem",
name="variable_property",
field=models.ForeignKey(
blank=True,
null=True,
on_delete=django.db.models.deletion.CASCADE,
to="pyscada.VariableProperty",
),
),
]
================================================
FILE: pyscada/hmi/migrations/0025_widgetcontent_content_str.py
================================================
# Generated by Django 2.2.8 on 2020-09-07 07:31
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("hmi", "0024_auto_20191212_1516"),
]
operations = [
migrations.AddField(
model_name="widgetcontent",
name="content_str",
field=models.CharField(default="", max_length=400),
),
]
================================================
FILE: pyscada/hmi/migrations/0026_auto_20200915_1333.py
================================================
# Generated by Django 2.2.8 on 2020-09-15 13:33
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
("pyscada", "0061_devicereadtask"),
("hmi", "0025_widgetcontent_content_str"),
]
operations = [
migrations.AddField(
model_name="controlitem",
name="color_1",
field=models.ForeignKey(
blank=True,
null=True,
on_delete=django.db.models.deletion.SET_NULL,
related_name="color_1",
to="pyscada.Color",
),
),
migrations.AddField(
model_name="controlitem",
name="color_2",
field=models.ForeignKey(
blank=True,
null=True,
on_delete=django.db.models.deletion.SET_NULL,
related_name="color_2",
to="pyscada.Color",
),
),
migrations.AddField(
model_name="controlitem",
name="color_3",
field=models.ForeignKey(
blank=True,
help_text="Only needed for 3 colors",
null=True,
on_delete=django.db.models.deletion.SET_NULL,
related_name="color_3",
to="pyscada.Color",
),
),
migrations.AddField(
model_name="controlitem",
name="color_level_1",
field=models.PositiveSmallIntegerField(default=0),
),
migrations.AddField(
model_name="controlitem",
name="color_level_2",
field=models.PositiveSmallIntegerField(
default=50, help_text="Only needed for 3 colors and gradient"
),
),
migrations.AddField(
model_name="controlitem",
name="display_type_color",
field=models.PositiveSmallIntegerField(
choices=[(0, "Value only"), (1, "Color only"), (2, "Value and color")],
default=0,
),
),
migrations.AddField(
model_name="controlitem",
name="display_value_color",
field=models.PositiveSmallIntegerField(
choices=[
(0, "No color"),
(1, "2 color"),
(2, "3 colors"),
(3, "color gradient"),
],
default=0,
help_text="For boolean no level needed and will use color 1 and 2",
),
),
migrations.AddField(
model_name="controlitem",
name="display_value_transformation",
field=models.PositiveSmallIntegerField(
choices=[
(0, "None"),
(1, "Timestamp to local date"),
(2, "Dictionary"),
],
default=0,
),
),
migrations.AddField(
model_name="controlitem",
name="display_value_transformation_parameter",
field=models.CharField(default="", max_length=400),
),
migrations.AlterField(
model_name="controlitem",
name="type",
field=models.PositiveSmallIntegerField(
choices=[(0, "Control Element"), (1, "Display Value")], default=0
),
),
]
================================================
FILE: pyscada/hmi/migrations/0027_auto_20200915_1407.py
================================================
# Generated by Django 2.2.8 on 2020-09-15 14:07
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
("hmi", "0026_auto_20200915_1333"),
]
operations = [
migrations.RenameField(
model_name="controlitem",
old_name="display_value_color",
new_name="display_value_color_type",
),
migrations.RenameField(
model_name="controlitem",
old_name="display_type_color",
new_name="display_value_mode",
),
]
================================================
FILE: pyscada/hmi/migrations/0028_auto_20200915_1540.py
================================================
# Generated by Django 2.2.8 on 2020-09-15 15:40
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("hmi", "0027_auto_20200915_1407"),
]
operations = [
migrations.AlterField(
model_name="controlitem",
name="display_value_transformation_parameter",
field=models.CharField(blank=True, default="", max_length=400, null=True),
),
]
================================================
FILE: pyscada/hmi/migrations/0029_auto_20200916_0720.py
================================================
# Generated by Django 2.2.8 on 2020-09-16 07:20
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
("pyscada", "0061_devicereadtask"),
("hmi", "0028_auto_20200915_1540"),
]
operations = [
migrations.RemoveField(
model_name="controlitem",
name="color_1",
),
migrations.RemoveField(
model_name="controlitem",
name="color_2",
),
migrations.RemoveField(
model_name="controlitem",
name="color_3",
),
migrations.RemoveField(
model_name="controlitem",
name="color_level_1",
),
migrations.RemoveField(
model_name="controlitem",
name="color_level_2",
),
migrations.RemoveField(
model_name="controlitem",
name="display_value_color_type",
),
migrations.RemoveField(
model_name="controlitem",
name="display_value_mode",
),
migrations.RemoveField(
model_name="controlitem",
name="display_value_transformation",
),
migrations.RemoveField(
model_name="controlitem",
name="display_value_transformation_parameter",
),
migrations.CreateModel(
name="DisplayValueOption",
fields=[
(
"id",
models.AutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
("name", models.CharField(max_length=400)),
(
"display_value_color_type",
models.PositiveSmallIntegerField(
choices=[
(0, "No color"),
(1, "2 color"),
(2, "3 colors"),
(3, "color gradient"),
],
default=0,
help_text="For boolean no level needed and will use color 1 and 2",
),
),
("color_level_1", models.PositiveSmallIntegerField(default=0)),
(
"color_level_1_type",
models.PositiveSmallIntegerField(
choices=[(0, "color 1 =< level 1"), (1, "color 1 < level 1")],
default=0,
help_text="Only needed for 2 or 3 colors",
),
),
(
"color_level_2",
models.PositiveSmallIntegerField(
default=50, help_text="Only needed for 3 colors and gradient"
),
),
(
"color_level_2_type",
models.PositiveSmallIntegerField(
choices=[(0, "color 2 =< level 2"), (1, "color 2 < level 2")],
default=0,
help_text="Only needed for 3 colors",
),
),
(
"display_value_mode",
models.PositiveSmallIntegerField(
choices=[
(0, "Value only"),
(1, "Color only"),
(2, "Value and color"),
],
default=0,
),
),
(
"display_value_transformation",
models.PositiveSmallIntegerField(
choices=[
(0, "None"),
(1, "Timestamp to local date"),
(2, "Dictionary"),
],
default=0,
),
),
(
"display_value_transformation_parameter",
models.CharField(blank=True, default="", max_length=400, null=True),
),
(
"color_1",
models.ForeignKey(
blank=True,
null=True,
on_delete=django.db.models.deletion.SET_NULL,
related_name="color_1",
to="pyscada.Color",
),
),
(
"color_2",
models.ForeignKey(
blank=True,
null=True,
on_delete=django.db.models.deletion.SET_NULL,
related_name="color_2",
to="pyscada.Color",
),
),
(
"color_3",
models.ForeignKey(
blank=True,
help_text="Only needed for 3 colors",
null=True,
on_delete=django.db.models.deletion.SET_NULL,
related_name="color_3",
to="pyscada.Color",
),
),
],
),
migrations.AddField(
model_name="controlitem",
name="display_value_options",
field=models.ForeignKey(
blank=True,
null=True,
on_delete=django.db.models.deletion.SET_NULL,
to="hmi.DisplayValueOption",
),
),
]
================================================
FILE: pyscada/hmi/migrations/0030_auto_20200918_0842.py
================================================
# Generated by Django 2.2.8 on 2020-09-18 08:42
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("hmi", "0029_auto_20200916_0720"),
]
operations = [
migrations.AlterField(
model_name="displayvalueoption",
name="display_value_transformation",
field=models.PositiveSmallIntegerField(
choices=[
(0, "None"),
(1, "Timestamp to local date"),
(2, "Timestamp to local time"),
(3, "Timestamp to local date and time"),
(4, "Dictionary"),
],
default=0,
),
),
]
================================================
FILE: pyscada/hmi/migrations/0031_auto_20200918_1206.py
================================================
# Generated by Django 2.2.8 on 2020-09-18 12:06
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
("hmi", "0030_auto_20200918_0842"),
]
operations = [
migrations.RemoveField(
model_name="processflowdiagramitem",
name="label",
),
migrations.RemoveField(
model_name="processflowdiagramitem",
name="type",
),
migrations.RemoveField(
model_name="processflowdiagramitem",
name="variable",
),
migrations.AddField(
model_name="processflowdiagramitem",
name="control_item",
field=models.ForeignKey(
blank=True,
default=None,
null=True,
on_delete=django.db.models.deletion.SET_NULL,
to="hmi.ControlItem",
),
),
migrations.AlterField(
model_name="displayvalueoption",
name="color_1",
field=models.ForeignKey(
blank=True,
default="",
null=True,
on_delete=django.db.models.deletion.SET_NULL,
related_name="color_1",
to="pyscada.Color",
),
),
]
================================================
FILE: pyscada/hmi/migrations/0032_auto_20200918_1408.py
================================================
# Generated by Django 2.2.8 on 2020-09-18 14:08
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("hmi", "0031_auto_20200918_1206"),
]
operations = [
migrations.AlterField(
model_name="displayvalueoption",
name="color_level_1",
field=models.FloatField(default=0),
),
migrations.AlterField(
model_name="displayvalueoption",
name="color_level_2",
field=models.FloatField(
default=50, help_text="Only needed for 3 colors and gradient"
),
),
]
================================================
FILE: pyscada/hmi/migrations/0033_auto_20200918_1439.py
================================================
# Generated by Django 2.2.8 on 2020-09-18 14:39
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("hmi", "0032_auto_20200918_1408"),
]
operations = [
migrations.AlterField(
model_name="form",
name="control_items",
field=models.ManyToManyField(
blank=True,
limit_choices_to={"type": "1"},
related_name="control_items_form",
to="hmi.ControlItem",
),
),
]
================================================
FILE: pyscada/hmi/migrations/0034_auto_20200918_1445.py
================================================
# Generated by Django 2.2.8 on 2020-09-18 14:45
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("hmi", "0033_auto_20200918_1439"),
]
operations = [
migrations.AlterField(
model_name="form",
name="hidden_control_items_to_true",
field=models.ManyToManyField(
blank=True,
limit_choices_to={"type": "1"},
related_name="hidden_control_items_form",
to="hmi.ControlItem",
),
),
]
================================================
FILE: pyscada/hmi/migrations/0035_auto_20200918_1517.py
================================================
# Generated by Django 2.2.8 on 2020-09-18 15:17
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("hmi", "0034_auto_20200918_1445"),
]
operations = [
migrations.AlterField(
model_name="form",
name="control_items",
field=models.ManyToManyField(
blank=True,
limit_choices_to={"type": "0"},
related_name="control_items_form",
to="hmi.ControlItem",
),
),
migrations.AlterField(
model_name="form",
name="hidden_control_items_to_true",
field=models.ManyToManyField(
blank=True,
limit_choices_to={"type": "0"},
related_name="hidden_control_items_form",
to="hmi.ControlItem",
),
),
]
================================================
FILE: pyscada/hmi/migrations/0036_auto_20200923_0850.py
================================================
# Generated by Django 2.2.8 on 2020-09-23 08:50
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("hmi", "0035_auto_20200918_1517"),
]
operations = [
migrations.RenameField(
model_name="xychart",
old_name="y_axis_plotpoints",
new_name="show_plot_points",
),
migrations.AddField(
model_name="chart",
name="show_plot_lines",
field=models.PositiveSmallIntegerField(
default=2, help_text="Show the plot lines"
),
),
migrations.AddField(
model_name="chart",
name="show_plot_points",
field=models.BooleanField(default=False, help_text="Show the plots points"),
),
migrations.AddField(
model_name="chart",
name="y_axis_uniquescale",
field=models.BooleanField(
default=True, help_text="To have a unique scale for all the y axis"
),
),
migrations.AddField(
model_name="xychart",
name="show_plot_lines",
field=models.PositiveSmallIntegerField(
default=1, help_text="Show the plot lines"
),
),
]
================================================
FILE: pyscada/hmi/migrations/0037_auto_20200923_0852.py
================================================
# Generated by Django 2.2.8 on 2020-09-23 08:52
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("hmi", "0036_auto_20200923_0850"),
]
operations = [
migrations.AlterField(
model_name="chart",
name="show_plot_lines",
field=models.PositiveSmallIntegerField(
choices=[(0, "No"), (1, "Yes"), (2, "Yes as steps")],
default=2,
help_text="Show the plot lines",
),
),
migrations.AlterField(
model_name="xychart",
name="show_plot_lines",
field=models.PositiveSmallIntegerField(
choices=[(0, "No"), (1, "Yes"), (2, "Yes as steps")],
default=1,
help_text="Show the plot lines",
),
),
]
================================================
FILE: pyscada/hmi/migrations/0038_auto_20200929_1410.py
================================================
# Generated by Django 2.2.8 on 2020-09-29 14:10
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
("hmi", "0037_auto_20200923_0852"),
]
operations = [
migrations.RemoveField(
model_name="dropdown",
name="items",
),
migrations.AddField(
model_name="dropdownitem",
name="dropdown",
field=models.ForeignKey(
blank=True,
null=True,
on_delete=django.db.models.deletion.CASCADE,
to="hmi.DropDown",
),
),
]
================================================
FILE: pyscada/hmi/migrations/0039_auto_20201002_0928.py
================================================
# Generated by Django 2.2.8 on 2020-10-02 09:28
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
("hmi", "0038_auto_20200929_1410"),
]
operations = [
migrations.RenameField(
model_name="displayvalueoption",
old_name="display_value_color_type",
new_name="color_type",
),
migrations.RenameField(
model_name="displayvalueoption",
old_name="display_value_mode",
new_name="mode",
),
migrations.RenameField(
model_name="dropdown",
old_name="title",
new_name="label",
),
migrations.RemoveField(
model_name="displayvalueoption",
name="display_value_transformation",
),
migrations.RemoveField(
model_name="displayvalueoption",
name="display_value_transformation_parameter",
),
migrations.AddField(
model_name="displayvalueoption",
name="timestamp_conversion",
field=models.PositiveSmallIntegerField(
choices=[
(0, "None"),
(1, "Timestamp to local date"),
(2, "Timestamp to local time"),
(3, "Timestamp to local date and time"),
],
default=0,
),
),
migrations.AlterField(
model_name="displayvalueoption",
name="color_1",
field=models.ForeignKey(
blank=True,
null=True,
on_delete=django.db.models.deletion.SET_NULL,
related_name="color_1",
to="pyscada.Color",
),
),
migrations.AlterField(
model_name="dropdown",
name="variable",
field=models.ForeignKey(
blank=True,
null=True,
on_delete=django.db.models.deletion.CASCADE,
to="pyscada.Variable",
),
),
migrations.AlterField(
model_name="dropdown",
name="variable_property",
field=models.ForeignKey(
blank=True,
null=True,
on_delete=django.db.models.deletion.CASCADE,
to="pyscada.VariableProperty",
),
),
migrations.DeleteModel(
name="DropDownItem",
),
]
================================================
FILE: pyscada/hmi/migrations/0040_dictionary_dictionaryitem.py
================================================
# Generated by Django 2.2.8 on 2020-10-02 09:30
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
("hmi", "0039_auto_20201002_0928"),
]
operations = [
migrations.CreateModel(
name="Dictionary",
fields=[
("id", models.AutoField(primary_key=True, serialize=False)),
("name", models.CharField(default="", max_length=400)),
],
),
migrations.CreateModel(
name="DictionaryItem",
fields=[
("id", models.AutoField(primary_key=True, serialize=False)),
("label", models.CharField(default="", max_length=400)),
("value", models.CharField(default="", max_length=400)),
(
"dictionary",
models.ForeignKey(
blank=True,
null=True,
on_delete=django.db.models.deletion.CASCADE,
to="hmi.Dictionary",
),
),
],
),
]
================================================
FILE: pyscada/hmi/migrations/0041_auto_20201002_0934.py
================================================
# Generated by Django 2.2.8 on 2020-10-02 09:34
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
("hmi", "0040_dictionary_dictionaryitem"),
]
operations = [
migrations.AddField(
model_name="displayvalueoption",
name="dictionary",
field=models.ForeignKey(
blank=True,
null=True,
on_delete=django.db.models.deletion.SET_NULL,
to="hmi.Dictionary",
),
),
migrations.AddField(
model_name="dropdown",
name="dictionary",
field=models.ForeignKey(
blank=True,
null=True,
on_delete=django.db.models.deletion.SET_NULL,
to="hmi.Dictionary",
),
),
]
================================================
FILE: pyscada/hmi/migrations/0042_auto_20201201_1335.py
================================================
# Generated by Django 2.2.8 on 2020-12-01 13:35
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
("pyscada", "0078_auto_20201123_1906"),
("hmi", "0041_auto_20201002_0934"),
]
operations = [
migrations.AddField(
model_name="chart",
name="x_axis_linlog",
field=models.BooleanField(
default=False, help_text="False->Lin / True->Log"
),
),
migrations.AddField(
model_name="chart",
name="x_axis_var",
field=models.ForeignKey(
default=None,
null=True,
on_delete=django.db.models.deletion.SET_NULL,
related_name="x_axis_var",
to="pyscada.Variable",
),
),
]
================================================
FILE: pyscada/hmi/migrations/0043_auto_20201201_1411.py
================================================
# Generated by Django 2.2.8 on 2020-12-01 14:11
from django.db import migrations
from pyscada.hmi.models import Chart as ChartModel
from time import time
import logging
logger = logging.getLogger(__name__)
charts_dict = {}
def add_vars_move_wc(apps, schema_editor):
XYChart = apps.get_model("hmi.XYChart")
Chart = apps.get_model("hmi.Chart")
WidgetContent = apps.get_model("hmi.WidgetContent")
Widget = apps.get_model("hmi.Widget")
Variable = apps.get_model("pyscada.Variable")
for xy in charts_dict:
item = XYChart.objects.get(id=xy)
c = Chart.objects.get(id=charts_dict[xy])
for v in item.variables.all():
c.variables.add(Variable.objects.get(id=v.id))
c.save()
try:
def fullname(o):
return o.__module__ + "." + o.__class__.__name__
instance = ChartModel.objects.get(id=c.id)
c = WidgetContent.objects.update_or_create(
content_pk=instance.pk,
content_model=fullname(instance),
defaults={"content_str": instance.__str__()},
)
wcxy = WidgetContent.objects.get(
content_pk=item.id, content_model__contains=".XYChart"
)
wc = WidgetContent.objects.get(
content_pk=c.id, content_model__contains=".Chart"
)
Widget.objects.filter(content=wcxy).update(content=wc)
if wcxy is not None:
wcxy.delete()
except Exception as e:
logger.info(e)
def move_xy_chart(apps, schema_editor):
XYChart = apps.get_model("hmi.XYChart")
Chart = apps.get_model("hmi.Chart")
Variable = apps.get_model("pyscada.Variable")
xy_chart_set = XYChart.objects.all()
count = 0
timeout = time() + 60 * 5
for item in xy_chart_set:
variables_list = []
for v in item.variables.all():
variables_list.append(Variable.objects.get(id=v.id))
c = Chart(
title=item.title,
x_axis_label=item.x_axis_label,
x_axis_var=Variable.objects.get(id=item.x_axis_var.id),
x_axis_linlog=item.x_axis_linlog,
y_axis_label=item.y_axis_label,
show_plot_points=item.show_plot_points,
show_plot_lines=item.show_plot_lines,
y_axis_uniquescale=item.y_axis_uniquescale,
)
c.save()
charts_dict[item.id] = c.id
if time() > timeout:
break
count += 1
logger.info("wrote %d lines in total\n" % count)
class Migration(migrations.Migration):
dependencies = [
("pyscada", "0078_auto_20201123_1906"),
("hmi", "0042_auto_20201201_1335"),
]
operations = [
migrations.RunPython(move_xy_chart, reverse_code=migrations.RunPython.noop),
migrations.RunPython(add_vars_move_wc, reverse_code=migrations.RunPython.noop),
migrations.RemoveField(
model_name="groupdisplaypermission",
name="xy_charts",
),
migrations.DeleteModel(
name="XYChart",
),
]
================================================
FILE: pyscada/hmi/migrations/0044_auto_20201201_1539.py
================================================
# Generated by Django 2.2.8 on 2020-12-01 15:39
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
("hmi", "0043_auto_20201201_1411"),
]
operations = [
migrations.AlterField(
model_name="chart",
name="x_axis_var",
field=models.ForeignKey(
blank=True,
default=None,
null=True,
on_delete=django.db.models.deletion.SET_NULL,
related_name="x_axis_var",
to="pyscada.Variable",
),
),
]
================================================
FILE: pyscada/hmi/migrations/0045_auto_20201201_2100.py
================================================
# Generated by Django 2.2.17 on 2020-12-01 21:00
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
("pyscada", "0078_auto_20201123_1906"),
("hmi", "0044_auto_20201201_1539"),
]
operations = [
migrations.CreateModel(
name="ChartAxis",
fields=[
(
"id",
models.AutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
("label", models.CharField(blank=True, default="", max_length=400)),
("min", models.FloatField(default=0)),
("max", models.FloatField(default=100)),
(
"show_plot_points",
models.BooleanField(
default=False, help_text="Show the plots points"
),
),
(
"show_plot_lines",
models.PositiveSmallIntegerField(
choices=[(0, "No"), (1, "Yes"), (2, "Yes as steps")],
default=2,
help_text="Show the plot lines",
),
),
(
"stack",
models.BooleanField(
default=False, help_text="Stack all variables of this axis"
),
),
(
"chart",
models.ForeignKey(
on_delete=django.db.models.deletion.CASCADE, to="hmi.Chart"
),
),
("variables", models.ManyToManyField(to="pyscada.Variable")),
],
),
]
================================================
FILE: pyscada/hmi/migrations/0046_auto_20201201_2109.py
================================================
# Generated by Django 2.2.17 on 2020-12-01 21:00
from django.db import migrations
from time import time
import logging
logger = logging.getLogger(__name__)
charts_dict = {}
def move_chart_vars(apps, schema_editor):
chart_model = apps.get_model("hmi.Chart")
chart_axis_model = apps.get_model("hmi.ChartAxis")
for chart in charts_dict:
item = chart_model.objects.get(id=chart)
axis = chart_axis_model.objects.get(id=charts_dict[chart])
axis.variables.set(item.variables.all())
def move_chart_axis(apps, schema_editor):
chart_model = apps.get_model("hmi.Chart")
chart_axis_model = apps.get_model("hmi.ChartAxis")
chart_set = chart_model.objects.all()
count = 0
timeout = time() + 60 * 5
for item in chart_set:
axis = chart_axis_model(
label=item.y_axis_label,
min=item.y_axis_min,
max=item.y_axis_max,
show_plot_points=item.show_plot_points,
show_plot_lines=item.show_plot_lines,
stack=False,
chart=chart_model.objects.get(id=item.id),
)
axis.save()
charts_dict[item.id] = axis.id
if time() > timeout:
break
count += 1
logger.info("wrote %d lines in total\n" % count)
class Migration(migrations.Migration):
dependencies = [
("hmi", "0045_auto_20201201_2100"),
]
operations = [
migrations.RunPython(move_chart_axis, reverse_code=migrations.RunPython.noop),
migrations.RunPython(move_chart_vars, reverse_code=migrations.RunPython.noop),
migrations.RemoveField(
model_name="chart",
name="show_plot_lines",
),
migrations.RemoveField(
model_name="chart",
name="show_plot_points",
),
migrations.RemoveField(
model_name="chart",
name="variables",
),
migrations.RemoveField(
model_name="chart",
name="y_axis_label",
),
migrations.RemoveField(
model_name="chart",
name="y_axis_max",
),
migrations.RemoveField(
model_name="chart",
name="y_axis_min",
),
migrations.RemoveField(
model_name="chart",
name="y_axis_uniquescale",
),
]
================================================
FILE: pyscada/hmi/migrations/0047_auto_20201202_1445.py
================================================
# Generated by Django 2.2.8 on 2020-12-02 14:45
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("hmi", "0046_auto_20201201_2109"),
]
operations = [
migrations.AlterModelOptions(
name="chartaxis",
options={"verbose_name": "Y Axis", "verbose_name_plural": "Y Axis"},
),
migrations.AddField(
model_name="chartaxis",
name="position",
field=models.PositiveSmallIntegerField(
choices=[(0, "left"), (1, "right")], default=0
),
),
]
================================================
FILE: pyscada/hmi/migrations/0048_chartaxis_fill.py
================================================
# Generated by Django 2.2.8 on 2020-12-02 16:21
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("hmi", "0047_auto_20201202_1445"),
]
operations = [
migrations.AddField(
model_name="chartaxis",
name="fill",
field=models.BooleanField(
default=False, help_text="Fill all variables of this axis"
),
),
]
================================================
FILE: pyscada/hmi/migrations/0049_auto_20201202_2037.py
================================================
# Generated by Django 2.2.17 on 2020-12-02 20:37
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("hmi", "0048_chartaxis_fill"),
]
operations = [
migrations.AlterField(
model_name="chartaxis",
name="max",
field=models.FloatField(blank=True, null=True),
),
migrations.AlterField(
model_name="chartaxis",
name="min",
field=models.FloatField(blank=True, null=True),
),
]
================================================
FILE: pyscada/hmi/migrations/0050_auto_20201203_2101.py
================================================
# Generated by Django 2.2.17 on 2020-12-03 21:01
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
("hmi", "0049_auto_20201202_2037"),
]
operations = [
migrations.CreateModel(
name="ControlElementOption",
fields=[
(
"id",
models.AutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
("name", models.CharField(max_length=400)),
(
"placeholder",
models.CharField(default="Enter a value", max_length=30),
),
("empty_dictionary", models.BooleanField(default=False)),
(
"dictionary",
models.ForeignKey(
blank=True,
null=True,
on_delete=django.db.models.deletion.SET_NULL,
to="hmi.Dictionary",
),
),
],
),
migrations.AddField(
model_name="controlitem",
name="control_element_options",
field=models.ForeignKey(
blank=True,
null=True,
on_delete=django.db.models.deletion.SET_NULL,
to="hmi.ControlElementOption",
),
),
]
================================================
FILE: pyscada/hmi/migrations/0051_auto_20201204_0901.py
================================================
# Generated by Django 2.2.17 on 2020-12-03 21:01
from django.db import migrations
from time import time
import logging
logger = logging.getLogger(__name__)
dd_dict = {}
control_element_dict = {}
def move_dropdown_in_control_panel(apps, schema_editor):
control_item_model = apps.get_model("hmi.ControlItem")
control_panel_model = apps.get_model("hmi.ControlPanel")
control_panel_model_set = control_panel_model.objects.all()
form_model = apps.get_model("hmi.Form")
form_model_set = form_model.objects.all()
count = 0
timeout = time() + 60 * 5
for item in control_panel_model_set:
for dd in item.dropdowns.all():
item.items.add(
control_item_model.objects.get(id=control_element_dict[dd.id])
)
if time() > timeout:
break
count += 1
for item in form_model_set:
for dd in item.dropdowns.all():
item.control_items.add(
control_item_model.objects.get(id=control_element_dict[dd.id])
)
if time() > timeout:
break
count += 1
logger.info("move %d dropdown in total\n" % count)
def move_dropdown(apps, schema_editor):
dropdown = apps.get_model("hmi.DropDown")
control_item_model = apps.get_model("hmi.ControlItem")
control_element_option_model = apps.get_model("hmi.ControlElementOption")
dropdown_set = dropdown.objects.all()
count = 0
timeout = time() + 60 * 5
for item in dropdown_set:
control_item = control_item_model(
label=item.label,
position=0,
type=0,
variable=item.variable,
variable_property=item.variable_property,
display_value_options=None,
control_element_options=control_element_option_model.objects.get(
id=dd_dict[item.id]
),
)
control_item.save()
control_element_dict[item.id] = control_item.id
if time() > timeout:
break
count += 1
logger.info("move %d dropdown in total\n" % count)
def create_control_element_option(apps, schema_editor):
dropdown = apps.get_model("hmi.DropDown")
control_element_option_model = apps.get_model("hmi.ControlElementOption")
dropdown_set = dropdown.objects.all()
count = 0
timeout = time() + 60 * 5
for item in dropdown_set:
control_element_option = control_element_option_model(
name=item.label,
placeholder=item.empty_value,
dictionary=item.dictionary,
empty_dictionary=item.empty,
)
control_element_option.save()
dd_dict[item.id] = control_element_option.id
if time() > timeout:
break
count += 1
logger.info("create %d control element option in total\n" % count)
class Migration(migrations.Migration):
dependencies = [
("hmi", "0050_auto_20201203_2101"),
]
operations = [
migrations.RunPython(
create_control_element_option, reverse_code=migrations.RunPython.noop
),
migrations.RunPython(move_dropdown, reverse_code=migrations.RunPython.noop),
migrations.RunPython(
move_dropdown_in_control_panel, reverse_code=migrations.RunPython.noop
),
]
================================================
FILE: pyscada/hmi/migrations/0052_auto_20201204_0949.py
================================================
# Generated by Django 2.2.8 on 2020-12-04 09:49
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
("hmi", "0051_auto_20201204_0901"),
]
operations = [
migrations.RemoveField(
model_name="controlpanel",
name="dropdowns",
),
migrations.RemoveField(
model_name="form",
name="dropdowns",
),
migrations.RemoveField(
model_name="groupdisplaypermission",
name="dropdowns",
),
migrations.DeleteModel(
name="DropDown",
),
]
================================================
FILE: pyscada/hmi/migrations/0053_auto_20211118_1438.py
================================================
# Generated by Django 2.2.8 on 2021-11-18 14:38
import django.core.validators
from django.db import migrations, models
import logging
logger = logging.getLogger(__name__)
def radius_auto(apps, schema_editor):
# We can't import the Person model directly as it may be a newer
# version than this migration expects. We use the historical version.
Pie = apps.get_model("hmi", "Pie")
count = 0
for item in Pie.objects.using(schema_editor.connection.alias).all():
try:
int(item.radius)
except ValueError:
item.radius = 100
item.save()
count += 1
logger.info("changed %d Pies\n" % count)
class Migration(migrations.Migration):
dependencies = [
("pyscada", "0091_auto_20211118_1019"),
("hmi", "0052_auto_20201204_0949"),
]
operations = [
migrations.RunPython(radius_auto, reverse_code=migrations.RunPython.noop),
migrations.AddField(
model_name="pie",
name="variable_properties",
field=models.ManyToManyField(blank=True, to="pyscada.VariableProperty"),
),
migrations.AlterField(
model_name="pie",
name="innerRadius",
field=models.PositiveSmallIntegerField(
default=0,
validators=[
django.core.validators.MaxValueValidator(100),
django.core.validators.MinValueValidator(0),
],
),
),
migrations.AlterField(
model_name="pie",
name="radius",
field=models.PositiveSmallIntegerField(
default=100,
validators=[
django.core.validators.MaxValueValidator(100),
django.core.validators.MinValueValidator(1),
],
),
),
migrations.AlterField(
model_name="pie",
name="variables",
field=models.ManyToManyField(blank=True, to="pyscada.Variable"),
),
]
================================================
FILE: pyscada/hmi/migrations/0054_displayvalueoption_type.py
================================================
# Generated by Django 2.2.8 on 2021-11-18 16:35
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("hmi", "0053_auto_20211118_1438"),
]
operations = [
migrations.AddField(
model_name="displayvalueoption",
name="type",
field=models.PositiveSmallIntegerField(
choices=[
(0, "Classic (Div)"),
(1, "Horizontal gauge"),
(2, "Vertical gauge"),
(3, "Circular gauge"),
],
default=0,
),
),
]
================================================
FILE: pyscada/hmi/migrations/0055_auto_20211125_1405.py
================================================
# Generated by Django 2.2.8 on 2021-11-25 14:05
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("pyscada", "0094_move_dictionaries"),
("hmi", "0054_displayvalueoption_type"),
]
operations = [
migrations.RemoveField(
model_name="dictionaryitem",
name="dictionary",
),
migrations.RemoveField(
model_name="controlelementoption",
name="dictionary",
),
migrations.RemoveField(
model_name="controlelementoption",
name="empty_dictionary",
),
migrations.RemoveField(
model_name="displayvalueoption",
name="dictionary",
),
migrations.AddField(
model_name="controlelementoption",
name="dropdown",
field=models.BooleanField(
default=False,
help_text="Show control item as dropdown. The variable must have a dictionary",
),
),
migrations.AddField(
model_name="controlelementoption",
name="empty_dropdown_value",
field=models.BooleanField(
default=False,
help_text="If true, show placeholder as default unelectable text",
),
),
migrations.DeleteModel(
name="Dictionary",
),
migrations.DeleteModel(
name="DictionaryItem",
),
]
================================================
FILE: pyscada/hmi/migrations/0056_auto_20211210_1608.py
================================================
# Generated by Django 2.2.8 on 2021-12-10 16:08
from django.db import migrations, models
from django.conf import settings
from PIL import Image
import logging
logger = logging.getLogger(__name__)
def add_height_width(apps, schema_editor):
# We can't import the Person model directly as it may be a newer
# version than this migration expects. We use the historical version.
ProcessFlowDiagram = apps.get_model("hmi", "ProcessFlowDiagram")
count = 0
for item in ProcessFlowDiagram.objects.using(schema_editor.connection.alias).all():
if str(item.url_height) == "100" and str(item.url_width) == "100":
if hasattr(settings, "MEDIA_ROOT"):
file_path = str(settings.MEDIA_ROOT) + str(item.background_image.name)
try:
img = Image.open(file_path)
item.url_height = int(img.height)
item.url_width = int(img.width)
item.save()
count += 1
except Exception as e:
logger.info(e)
logger.info("changed %d ProcessFlowDiagram\n" % count)
class Migration(migrations.Migration):
dependencies = [
("hmi", "0055_auto_20211125_1405"),
]
operations = [
migrations.AddField(
model_name="processflowdiagram",
name="url_height",
field=models.PositiveIntegerField(default="100", editable=False),
),
migrations.AddField(
model_name="processflowdiagram",
name="url_width",
field=models.PositiveIntegerField(default="100", editable=False),
),
migrations.AlterField(
model_name="processflowdiagram",
name="background_image",
field=models.ImageField(
blank=True,
height_field="url_height",
upload_to="img/",
verbose_name="background image",
width_field="url_width",
),
),
migrations.RunPython(add_height_width, reverse_code=migrations.RunPython.noop),
]
================================================
FILE: pyscada/hmi/migrations/0057_auto_20211214_1157.py
================================================
# Generated by Django 2.2.8 on 2021-12-14 11:57
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("hmi", "0056_auto_20211210_1608"),
]
operations = [
migrations.AddField(
model_name="processflowdiagram",
name="type",
field=models.PositiveSmallIntegerField(
choices=[(0, "HTML"), (1, "SVG")],
default=0,
help_text="HTML is not responsive and can display control element
SVG is responsive and cannot display control element",
),
),
migrations.AddField(
model_name="processflowdiagramitem",
name="font_size",
field=models.PositiveSmallIntegerField(default=14),
),
]
================================================
FILE: pyscada/hmi/migrations/0058_auto_20220523_1639.py
================================================
# Generated by Django 3.2 on 2022-05-23 16:39
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
("hmi", "0057_auto_20211214_1157"),
]
operations = [
migrations.CreateModel(
name="Theme",
fields=[
(
"id",
models.AutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
("name", models.CharField(max_length=400)),
(
"base_filename",
models.CharField(
default="base",
help_text="Enter the filename without '.html'",
max_length=400,
),
),
(
"view_filename",
models.CharField(
default="view",
help_text="Enter the filename without '.html'",
max_length=400,
),
),
],
),
migrations.AddField(
model_name="view",
name="theme",
field=models.ForeignKey(
default=None,
null=True,
on_delete=django.db.models.deletion.SET_NULL,
to="hmi.theme",
),
),
]
================================================
FILE: pyscada/hmi/migrations/0059_alter_view_theme.py
================================================
# Generated by Django 3.2.13 on 2022-05-24 19:48
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
("hmi", "0058_auto_20220523_1639"),
]
operations = [
migrations.AlterField(
model_name="view",
name="theme",
field=models.ForeignKey(
blank=True,
default=None,
null=True,
on_delete=django.db.models.deletion.SET_NULL,
to="hmi.theme",
),
),
]
================================================
FILE: pyscada/hmi/migrations/0060_chartaxis_show_bars.py
================================================
# Generated by Django 3.2 on 2022-05-25 16:34
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("hmi", "0059_alter_view_theme"),
]
operations = [
migrations.AddField(
model_name="chartaxis",
name="show_bars",
field=models.BooleanField(default=False, help_text="Show bars"),
),
]
================================================
FILE: pyscada/hmi/migrations/0061_auto_20220610_1459.py
================================================
# Generated by Django 3.2 on 2022-06-10 14:59
from django.db import migrations, models
import pyscada.hmi.models
class Migration(migrations.Migration):
dependencies = [
("hmi", "0060_chartaxis_show_bars"),
]
operations = [
migrations.AlterField(
model_name="theme",
name="base_filename",
field=models.CharField(
default="base",
help_text="Enter the filename without '.html'",
max_length=400,
# validators=[pyscada.hmi.models.validate_tempalte],
),
),
migrations.AlterField(
model_name="theme",
name="view_filename",
field=models.CharField(
default="view",
help_text="Enter the filename without '.html'",
max_length=400,
# validators=[pyscada.hmi.models.validate_tempalte],
),
),
]
================================================
FILE: pyscada/hmi/migrations/0062_auto_20220616_1523.py
================================================
# Generated by Django 3.2 on 2022-06-16 15:23
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
("hmi", "0061_auto_20220610_1459"),
]
operations = [
migrations.AlterField(
model_name="groupdisplaypermission",
name="charts",
field=models.ManyToManyField(
blank=True, related_name="old_charts", to="hmi.Chart"
),
),
migrations.AlterField(
model_name="groupdisplaypermission",
name="control_items",
field=models.ManyToManyField(
blank=True, related_name="old_control_items", to="hmi.ControlItem"
),
),
migrations.AlterField(
model_name="groupdisplaypermission",
name="custom_html_panels",
field=models.ManyToManyField(
blank=True,
related_name="old_custom_html_panels",
to="hmi.CustomHTMLPanel",
),
),
migrations.AlterField(
model_name="groupdisplaypermission",
name="forms",
field=models.ManyToManyField(
blank=True, related_name="old_forms", to="hmi.Form"
),
),
migrations.AlterField(
model_name="groupdisplaypermission",
name="pages",
field=models.ManyToManyField(
blank=True, related_name="old_pages", to="hmi.Page"
),
),
migrations.AlterField(
model_name="groupdisplaypermission",
name="process_flow_diagram",
field=models.ManyToManyField(
blank=True,
related_name="old_process_flow_diagram",
to="hmi.ProcessFlowDiagram",
),
),
migrations.AlterField(
model_name="groupdisplaypermission",
name="sliding_panel_menus",
field=models.ManyToManyField(
blank=True,
related_name="old_sliding_panel_menus",
to="hmi.SlidingPanelMenu",
),
),
migrations.AlterField(
model_name="groupdisplaypermission",
name="views",
field=models.ManyToManyField(
blank=True, related_name="old_views", to="hmi.View"
),
),
migrations.AlterField(
model_name="groupdisplaypermission",
name="widgets",
field=models.ManyToManyField(
blank=True, related_name="old_widgets", to="hmi.Widget"
),
),
migrations.CreateModel(
name="WidgetGroupDisplayPermission",
fields=[
(
"id",
models.AutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
(
"type",
models.PositiveSmallIntegerField(
choices=[(0, "allow"), (1, "exclude")],
default=0,
help_text="If allow: only selected items can be seen by the group.
If exclude: allows all items except the selected ones.",
),
),
(
"group_display_permission",
models.OneToOneField(
null=True,
on_delete=django.db.models.deletion.SET_NULL,
to="hmi.groupdisplaypermission",
),
),
(
"widgets",
models.ManyToManyField(
blank=True,
related_name="groupdisplaypermission",
to="hmi.Widget",
),
),
],
),
migrations.CreateModel(
name="ViewGroupDisplayPermission",
fields=[
(
"id",
models.AutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
(
"type",
models.PositiveSmallIntegerField(
choices=[(0, "allow"), (1, "exclude")],
default=0,
help_text="If allow: only selected items can be seen by the group.
If exclude: allows all items except the selected ones.",
),
),
(
"group_display_permission",
models.OneToOneField(
null=True,
on_delete=django.db.models.deletion.SET_NULL,
to="hmi.groupdisplaypermission",
),
),
(
"views",
models.ManyToManyField(
blank=True, related_name="groupdisplaypermission", to="hmi.View"
),
),
],
),
migrations.CreateModel(
name="SlidingPanelMenuGroupDisplayPermission",
fields=[
(
"id",
models.AutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
(
"type",
models.PositiveSmallIntegerField(
choices=[(0, "allow"), (1, "exclude")],
default=0,
help_text="If allow: only selected items can be seen by the group.
If exclude: allows all items except the selected ones.",
),
),
(
"group_display_permission",
models.OneToOneField(
null=True,
on_delete=django.db.models.deletion.SET_NULL,
to="hmi.groupdisplaypermission",
),
),
(
"sliding_panel_menus",
models.ManyToManyField(
blank=True,
related_name="groupdisplaypermission",
to="hmi.SlidingPanelMenu",
),
),
],
),
migrations.CreateModel(
name="ProcessFlowDiagramGroupDisplayPermission",
fields=[
(
"id",
models.AutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
(
"type",
models.PositiveSmallIntegerField(
choices=[(0, "allow"), (1, "exclude")],
default=0,
help_text="If allow: only selected items can be seen by the group.
If exclude: allows all items except the selected ones.",
),
),
(
"group_display_permission",
models.OneToOneField(
null=True,
on_delete=django.db.models.deletion.SET_NULL,
to="hmi.groupdisplaypermission",
),
),
(
"process_flow_diagram",
models.ManyToManyField(
blank=True,
related_name="groupdisplaypermission",
to="hmi.ProcessFlowDiagram",
),
),
],
),
migrations.CreateModel(
name="PieGroupDisplayPermission",
fields=[
(
"id",
models.AutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
(
"type",
models.PositiveSmallIntegerField(
choices=[(0, "allow"), (1, "exclude")],
default=0,
help_text="If allow: only selected items can be seen by the group.
If exclude: allows all items except the selected ones.",
),
),
(
"group_display_permission",
models.OneToOneField(
null=True,
on_delete=django.db.models.deletion.SET_NULL,
to="hmi.groupdisplaypermission",
),
),
(
"pies",
models.ManyToManyField(
blank=True, related_name="groupdisplaypermission", to="hmi.Pie"
),
),
],
),
migrations.CreateModel(
name="PageGroupDisplayPermission",
fields=[
(
"id",
models.AutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
(
"type",
models.PositiveSmallIntegerField(
choices=[(0, "allow"), (1, "exclude")],
default=0,
help_text="If allow: only selected items can be seen by the group.
If exclude: allows all items except the selected ones.",
),
),
(
"group_display_permission",
models.OneToOneField(
null=True,
on_delete=django.db.models.deletion.SET_NULL,
to="hmi.groupdisplaypermission",
),
),
(
"pages",
models.ManyToManyField(
blank=True, related_name="groupdisplaypermission", to="hmi.Page"
),
),
],
),
migrations.CreateModel(
name="FormGroupDisplayPermission",
fields=[
(
"id",
models.AutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
(
"type",
models.PositiveSmallIntegerField(
choices=[(0, "allow"), (1, "exclude")],
default=0,
help_text="If allow: only selected items can be seen by the group.
If exclude: allows all items except the selected ones.",
),
),
(
"forms",
models.ManyToManyField(
blank=True, related_name="groupdisplaypermission", to="hmi.Form"
),
),
(
"group_display_permission",
models.OneToOneField(
null=True,
on_delete=django.db.models.deletion.SET_NULL,
to="hmi.groupdisplaypermission",
),
),
],
),
migrations.CreateModel(
name="CustomHTMLPanelGroupDisplayPermission",
fields=[
(
"id",
models.AutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
(
"type",
models.PositiveSmallIntegerField(
choices=[(0, "allow"), (1, "exclude")],
default=0,
help_text="If allow: only selected items can be seen by the group.
If exclude: allows all items except the selected ones.",
),
),
(
"custom_html_panels",
models.ManyToManyField(
blank=True,
related_name="groupdisplaypermission",
to="hmi.CustomHTMLPanel",
),
),
(
"group_display_permission",
models.OneToOneField(
null=True,
on_delete=django.db.models.deletion.SET_NULL,
to="hmi.groupdisplaypermission",
),
),
],
),
migrations.CreateModel(
name="ControlItemGroupDisplayPermission",
fields=[
(
"id",
models.AutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
(
"type",
models.PositiveSmallIntegerField(
choices=[(0, "allow"), (1, "exclude")],
default=0,
help_text="If allow: only selected items can be seen by the group.
If exclude: allows all items except the selected ones.",
),
),
(
"control_items",
models.ManyToManyField(
blank=True,
related_name="groupdisplaypermission",
to="hmi.ControlItem",
),
),
(
"group_display_permission",
models.OneToOneField(
null=True,
on_delete=django.db.models.deletion.SET_NULL,
to="hmi.groupdisplaypermission",
),
),
],
),
migrations.CreateModel(
name="ChartGroupDisplayPermission",
fields=[
(
"id",
models.AutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
(
"type",
models.PositiveSmallIntegerField(
choices=[(0, "allow"), (1, "exclude")],
default=0,
help_text="If allow: only selected items can be seen by the group.
If exclude: allows all items except the selected ones.",
),
),
(
"charts",
models.ManyToManyField(
blank=True,
related_name="groupdisplaypermission",
to="hmi.Chart",
),
),
(
"group_display_permission",
models.OneToOneField(
null=True,
on_delete=django.db.models.deletion.SET_NULL,
to="hmi.groupdisplaypermission",
),
),
],
),
]
================================================
FILE: pyscada/hmi/migrations/0063_move_group_display_permissions.py
================================================
# Generated by Django 2.2.8 on 2021-11-25 12:56
from django.db import migrations, models
import logging
logger = logging.getLogger(__name__)
charts_dict = {}
def move_group_display_permissions(apps, schema_editor):
HMIGroupDisplayPermissions = apps.get_model("hmi", "GroupDisplayPermission")
HMIPagesGroupDisplayPermissions = apps.get_model(
"hmi", "PageGroupDisplayPermission"
)
HMISlidingPanelMenuGroupDisplayPermission = apps.get_model(
"hmi", "SlidingPanelMenuGroupDisplayPermission"
)
HMIChartGroupDisplayPermission = apps.get_model(
"hmi", "ChartGroupDisplayPermission"
)
HMIControlItemGroupDisplayPermission = apps.get_model(
"hmi", "ControlItemGroupDisplayPermission"
)
HMIFormGroupDisplayPermission = apps.get_model("hmi", "FormGroupDisplayPermission")
HMIWidgetGroupDisplayPermission = apps.get_model(
"hmi", "WidgetGroupDisplayPermission"
)
HMICustomHTMLPanelGroupDisplayPermission = apps.get_model(
"hmi", "CustomHTMLPanelGroupDisplayPermission"
)
HMIViewGroupDisplayPermission = apps.get_model("hmi", "ViewGroupDisplayPermission")
HMIProcessFlowDiagramGroupDisplayPermission = apps.get_model(
"hmi", "ProcessFlowDiagramGroupDisplayPermission"
)
db_alias = schema_editor.connection.alias
hmi_group_display_permissions_set = HMIGroupDisplayPermissions.objects.all()
count = 0
pages_dict = []
for item in hmi_group_display_permissions_set:
if (
item.pages.count()
and HMIPagesGroupDisplayPermissions.objects.using(db_alias)
.filter(group_display_permission=item)
.count()
== 0
):
i = [
HMIPagesGroupDisplayPermissions(
group_display_permission=item,
)
]
HMIPagesGroupDisplayPermissions.objects.using(db_alias).bulk_create(i)
HMIPagesGroupDisplayPermissions.objects.using(db_alias).get(
group_display_permission=item
).pages.set(item.pages.all())
count += 1
if (
item.sliding_panel_menus.count()
and HMISlidingPanelMenuGroupDisplayPermission.objects.using(db_alias)
.filter(group_display_permission=item)
.count()
== 0
):
i = [
HMISlidingPanelMenuGroupDisplayPermission(
group_display_permission=item,
)
]
HMISlidingPanelMenuGroupDisplayPermission.objects.using(
db_alias
).bulk_create(i)
HMISlidingPanelMenuGroupDisplayPermission.objects.using(db_alias).get(
group_display_permission=item
).sliding_panel_menus.set(item.sliding_panel_menus.all())
count += 1
if (
item.charts.count()
and HMIChartGroupDisplayPermission.objects.using(db_alias)
.filter(group_display_permission=item)
.count()
== 0
):
i = [
HMIChartGroupDisplayPermission(
group_display_permission=item,
)
]
HMIChartGroupDisplayPermission.objects.using(db_alias).bulk_create(i)
HMIChartGroupDisplayPermission.objects.using(db_alias).get(
group_display_permission=item
).charts.set(item.charts.all())
count += 1
if (
item.control_items.count()
and HMIControlItemGroupDisplayPermission.objects.using(db_alias)
.filter(group_display_permission=item)
.count()
== 0
):
i = [
HMIControlItemGroupDisplayPermission(
group_display_permission=item,
)
]
HMIControlItemGroupDisplayPermission.objects.using(db_alias).bulk_create(i)
HMIControlItemGroupDisplayPermission.objects.using(db_alias).get(
group_display_permission=item
).control_items.set(item.control_items.all())
count += 1
if (
item.forms.count()
and HMIFormGroupDisplayPermission.objects.using(db_alias)
.filter(group_display_permission=item)
.count()
== 0
):
i = [
HMIFormGroupDisplayPermission(
group_display_permission=item,
)
]
HMIFormGroupDisplayPermission.objects.using(db_alias).bulk_create(i)
HMIFormGroupDisplayPermission.objects.using(db_alias).get(
group_display_permission=item
).forms.set(item.forms.all())
count += 1
if (
item.widgets.count()
and HMIWidgetGroupDisplayPermission.objects.using(db_alias)
.filter(group_display_permission=item)
.count()
== 0
):
i = [
HMIWidgetGroupDisplayPermission(
group_display_permission=item,
)
]
HMIWidgetGroupDisplayPermission.objects.using(db_alias).bulk_create(i)
HMIWidgetGroupDisplayPermission.objects.using(db_alias).get(
group_display_permission=item
).widgets.set(item.widgets.all())
count += 1
if (
item.custom_html_panels.count()
and HMICustomHTMLPanelGroupDisplayPermission.objects.using(db_alias)
.filter(group_display_permission=item)
.count()
== 0
):
i = [
HMICustomHTMLPanelGroupDisplayPermission(
group_display_permission=item,
)
]
HMICustomHTMLPanelGroupDisplayPermission.objects.using(
db_alias
).bulk_create(i)
HMICustomHTMLPanelGroupDisplayPermission.objects.using(db_alias).get(
group_display_permission=item
).custom_html_panels.set(item.custom_html_panels.all())
count += 1
if (
item.views.count()
and HMIViewGroupDisplayPermission.objects.using(db_alias)
.filter(group_display_permission=item)
.count()
== 0
):
i = [
HMIViewGroupDisplayPermission(
group_display_permission=item,
)
]
HMIViewGroupDisplayPermission.objects.using(db_alias).bulk_create(i)
HMIViewGroupDisplayPermission.objects.using(db_alias).get(
group_display_permission=item
).views.set(item.views.all())
count += 1
if (
item.process_flow_diagram.count()
and HMIProcessFlowDiagramGroupDisplayPermission.objects.using(db_alias)
.filter(group_display_permission=item)
.count()
== 0
):
i = [
HMIProcessFlowDiagramGroupDisplayPermission(
group_display_permission=item,
)
]
HMIProcessFlowDiagramGroupDisplayPermission.objects.using(
db_alias
).bulk_create(i)
HMIProcessFlowDiagramGroupDisplayPermission.objects.using(db_alias).get(
group_display_permission=item
).process_flow_diagram.set(item.process_flow_diagram.all())
count += 1
logger.info("moved %d Groups\n" % count)
class Migration(migrations.Migration):
dependencies = [
("hmi", "0062_auto_20220616_1523"),
]
operations = [
migrations.RunPython(
move_group_display_permissions, reverse_code=migrations.RunPython.noop
),
]
================================================
FILE: pyscada/hmi/migrations/0064_auto_20220617_1333.py
================================================
# Generated by Django 3.2 on 2022-06-17 13:33
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
("auth", "0012_alter_user_first_name_max_length"),
("hmi", "0063_move_group_display_permissions"),
]
operations = [
migrations.AlterField(
model_name="chartgroupdisplaypermission",
name="group_display_permission",
field=models.OneToOneField(
null=True,
on_delete=django.db.models.deletion.CASCADE,
to="hmi.groupdisplaypermission",
),
),
migrations.AlterField(
model_name="controlitemgroupdisplaypermission",
name="group_display_permission",
field=models.OneToOneField(
null=True,
on_delete=django.db.models.deletion.CASCADE,
to="hmi.groupdisplaypermission",
),
),
migrations.AlterField(
model_name="customhtmlpanelgroupdisplaypermission",
name="group_display_permission",
field=models.OneToOneField(
null=True,
on_delete=django.db.models.deletion.CASCADE,
to="hmi.groupdisplaypermission",
),
),
migrations.AlterField(
model_name="formgroupdisplaypermission",
name="group_display_permission",
field=models.OneToOneField(
null=True,
on_delete=django.db.models.deletion.CASCADE,
to="hmi.groupdisplaypermission",
),
),
migrations.AlterField(
model_name="groupdisplaypermission",
name="hmi_group",
field=models.OneToOneField(
null=True, on_delete=django.db.models.deletion.CASCADE, to="auth.group"
),
),
migrations.AlterField(
model_name="pagegroupdisplaypermission",
name="group_display_permission",
field=models.OneToOneField(
null=True,
on_delete=django.db.models.deletion.CASCADE,
to="hmi.groupdisplaypermission",
),
),
migrations.AlterField(
model_name="piegroupdisplaypermission",
name="group_display_permission",
field=models.OneToOneField(
null=True,
on_delete=django.db.models.deletion.CASCADE,
to="hmi.groupdisplaypermission",
),
),
migrations.AlterField(
model_name="processflowdiagramgroupdisplaypermission",
name="group_display_permission",
field=models.OneToOneField(
null=True,
on_delete=django.db.models.deletion.CASCADE,
to="hmi.groupdisplaypermission",
),
),
migrations.AlterField(
model_name="slidingpanelmenugroupdisplaypermission",
name="group_display_permission",
field=models.OneToOneField(
null=True,
on_delete=django.db.models.deletion.CASCADE,
to="hmi.groupdisplaypermission",
),
),
migrations.AlterField(
model_name="viewgroupdisplaypermission",
name="group_display_permission",
field=models.OneToOneField(
null=True,
on_delete=django.db.models.deletion.CASCADE,
to="hmi.groupdisplaypermission",
),
),
migrations.AlterField(
model_name="widgetgroupdisplaypermission",
name="group_display_permission",
field=models.OneToOneField(
null=True,
on_delete=django.db.models.deletion.CASCADE,
to="hmi.groupdisplaypermission",
),
),
]
================================================
FILE: pyscada/hmi/migrations/0065_auto_20220620_0854.py
================================================
# Generated by Django 3.2 on 2022-06-20 08:54
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
("hmi", "0064_auto_20220617_1333"),
]
operations = [
migrations.RemoveField(
model_name="groupdisplaypermission",
name="charts",
),
migrations.RemoveField(
model_name="groupdisplaypermission",
name="control_items",
),
migrations.RemoveField(
model_name="groupdisplaypermission",
name="custom_html_panels",
),
migrations.RemoveField(
model_name="groupdisplaypermission",
name="forms",
),
migrations.RemoveField(
model_name="groupdisplaypermission",
name="pages",
),
migrations.RemoveField(
model_name="groupdisplaypermission",
name="process_flow_diagram",
),
migrations.RemoveField(
model_name="groupdisplaypermission",
name="sliding_panel_menus",
),
migrations.RemoveField(
model_name="groupdisplaypermission",
name="views",
),
migrations.RemoveField(
model_name="groupdisplaypermission",
name="widgets",
),
]
================================================
FILE: pyscada/hmi/migrations/0066_auto_20221205_1435.py
================================================
# Generated by Django 3.2.13 on 2022-12-05 14:35
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
("hmi", "0065_auto_20220620_0854"),
]
operations = [
migrations.CreateModel(
name="CssClass",
fields=[
("id", models.AutoField(primary_key=True, serialize=False)),
("title", models.CharField(default="", max_length=400)),
("css_class", models.SlugField(default="", max_length=80)),
],
),
migrations.AddField(
model_name="widget",
name="extra_css_class",
field=models.ForeignKey(
blank=True,
default=None,
null=True,
on_delete=django.db.models.deletion.SET_NULL,
to="hmi.cssclass",
),
),
]
================================================
FILE: pyscada/hmi/migrations/0067_alter_cssclass_options.py
================================================
# Generated by Django 3.2 on 2023-01-13 09:33
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
("hmi", "0066_auto_20221205_1435"),
]
operations = [
migrations.AlterModelOptions(
name="cssclass",
options={"verbose_name_plural": "Css Classes"},
),
]
================================================
FILE: pyscada/hmi/migrations/0068_alter_displayvalueoption_timestamp_conversion.py
================================================
# Generated by Django 3.2 on 2023-02-02 14:50
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("hmi", "0067_alter_cssclass_options"),
]
operations = [
migrations.AlterField(
model_name="displayvalueoption",
name="timestamp_conversion",
field=models.PositiveSmallIntegerField(
choices=[
(0, "None"),
(1, "Timestamp in milliseconds to local date"),
(2, "Timestamp in milliseconds to local time"),
(3, "Timestamp in milliseconds to local date and time"),
(4, "Timestamp in seconds to local date"),
(5, "Timestamp in seconds to local time"),
(6, "Timestamp in seconds to local date and time"),
],
default=0,
),
),
]
================================================
FILE: pyscada/hmi/migrations/0069_displayvalueoption_color_and_more.py
================================================
# Generated by Django 4.2rc1 on 2023-03-30 07:48
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
("pyscada", "0100_device_instrument_handler"),
("hmi", "0068_alter_displayvalueoption_timestamp_conversion"),
]
operations = [
migrations.AddField(
model_name="displayvalueoption",
name="color",
field=models.ForeignKey(
blank=True,
help_text="Default color if no level defined, can be null.
Color < or =< first level, if a level is defined.",
null=True,
on_delete=django.db.models.deletion.CASCADE,
to="pyscada.color",
),
),
migrations.AddField(
model_name="displayvalueoption",
name="color_only",
field=models.BooleanField(
default=False, help_text="If true, will not display the value."
),
),
migrations.AddField(
model_name="displayvalueoption",
name="gradient",
field=models.BooleanField(
default=False, help_text="Need 1 color option to be defined."
),
),
migrations.AddField(
model_name="displayvalueoption",
name="gradient_higher_level",
field=models.FloatField(
default=0, help_text="Color defined above will be used for this level."
),
),
migrations.CreateModel(
name="DisplayValueColorOption",
fields=[
(
"id",
models.AutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
("color_level", models.FloatField()),
(
"color_level_type",
models.PositiveSmallIntegerField(
choices=[(0, "color =< level"), (1, "color < level")], default=0
),
),
(
"color",
models.ForeignKey(
blank=True,
help_text="Let blank for no color below the selected level.",
null=True,
on_delete=django.db.models.deletion.CASCADE,
to="pyscada.color",
),
),
(
"display_value_option",
models.ForeignKey(
on_delete=django.db.models.deletion.CASCADE,
to="hmi.displayvalueoption",
),
),
],
options={
"ordering": ["color_level", "-color_level_type"],
},
),
migrations.AddConstraint(
model_name="displayvaluecoloroption",
constraint=models.UniqueConstraint(
fields=("display_value_option", "color_level", "color_level_type"),
name="unique_display_value_color_option",
),
),
]
================================================
FILE: pyscada/hmi/migrations/0070_move_displayvalueoptions.py
================================================
# Generated by Django 2.2.8 on 2021-11-25 12:56
from django.db import migrations, models
from pyscada.hmi.models import DisplayValueColorOption, DisplayValueOption
import logging
logger = logging.getLogger(__name__)
charts_dict = {}
def move_dvo(apps, schema_editor):
dvo = apps.get_model("hmi", "DisplayValueOption")
dvco = apps.get_model("hmi", "DisplayValueColorOption")
db_alias = schema_editor.connection.alias
dvo_set = dvo.objects.all()
count = 0
countc = 0
dictc = []
dict = []
for item in dvo_set:
if item.mode == 1:
item.color_only = True
if item.color_type == 1:
item.color = item.color_1
if (
dvco.objects.filter(
display_value_option=item,
color_level=item.color_level_1,
color_level_type=item.color_level_1_type,
color=item.color_2,
).count()
== 0
):
dictc.append(
dvco(
display_value_option=item,
color_level=item.color_level_1,
color_level_type=item.color_level_1_type,
color=item.color_2,
)
)
countc += 1
elif item.color_type == 2:
item.color = item.color_1
if (
dvco.objects.filter(
display_value_option=item,
color_level=item.color_level_1,
color_level_type=item.color_level_1_type,
color=item.color_2,
).count()
== 0
):
dictc.append(
dvco(
display_value_option=item,
color_level=item.color_level_1,
color_level_type=item.color_level_1_type,
color=item.color_2,
)
)
if (
dvco.objects.filter(
display_value_option=item,
color_level=item.color_level_2,
color_level_type=item.color_level_2_type,
color=item.color_3,
).count()
== 0
):
dictc.append(
dvco(
display_value_option=item,
color_level=item.color_level_2,
color_level_type=item.color_level_2_type,
color=item.color_3,
)
)
countc += 2
elif item.color_type == 3:
item.color = item.color_1
if (
dvco.objects.filter(
display_value_option=item,
color_level=item.color_level_1,
color_level_type=item.color_level_1_type,
color=item.color_2,
).count()
== 0
):
dictc.append(
dvco(
display_value_option=item,
color_level=item.color_level_1,
color_level_type=item.color_level_1_type,
color=item.color_2,
)
)
item.gradient = True
item.gradient_higher_level = item.color_level_2
countc += 1
dict.append(item)
count += 1
logger.info("update %d DisplayValueOption\n" % count)
logger.info("create %d DisplayValueColorOption\n" % countc)
DisplayValueColorOption.objects.using(db_alias).bulk_create(dictc)
DisplayValueOption.objects.using(db_alias).bulk_update(
dict, ["color_only", "color", "gradient", "gradient_higher_level"]
)
class Migration(migrations.Migration):
dependencies = [
("pyscada", "0100_device_instrument_handler"),
("hmi", "0069_displayvalueoption_color_and_more"),
]
operations = [
migrations.RunPython(move_dvo, reverse_code=migrations.RunPython.noop),
]
================================================
FILE: pyscada/hmi/migrations/0071_remove_displayvalueoption_color_1_and_more.py
================================================
# Generated by Django 4.2rc1 on 2023-03-30 10:23
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
("hmi", "0070_move_displayvalueoptions"),
]
operations = [
migrations.RemoveField(
model_name="displayvalueoption",
name="color_1",
),
migrations.RemoveField(
model_name="displayvalueoption",
name="color_2",
),
migrations.RemoveField(
model_name="displayvalueoption",
name="color_3",
),
migrations.RemoveField(
model_name="displayvalueoption",
name="color_level_1",
),
migrations.RemoveField(
model_name="displayvalueoption",
name="color_level_1_type",
),
migrations.RemoveField(
model_name="displayvalueoption",
name="color_level_2",
),
migrations.RemoveField(
model_name="displayvalueoption",
name="color_level_2_type",
),
migrations.RemoveField(
model_name="displayvalueoption",
name="color_type",
),
migrations.RemoveField(
model_name="displayvalueoption",
name="mode",
),
]
================================================
FILE: pyscada/hmi/migrations/0072_alter_groupdisplaypermission_hmi_group.py
================================================
# Generated by Django 4.2 on 2023-04-06 14:40
from django.db import migrations, models
import django.db.models.deletion
from django.db.models.fields.related import OneToOneRel
import logging
logger = logging.getLogger(__name__)
def create_empty_group_display_permission(apps, schema_editor):
gdp = apps.get_model("hmi", "GroupDisplayPermission")
g = gdp.objects.get_or_create(hmi_group=None)
items = [
field
for field in gdp._meta.get_fields()
if issubclass(type(field), OneToOneRel)
]
for item in items:
item.related_model.objects.get_or_create(group_display_permission=g[0], type=1)
if g[1]:
logger.info("Empty GroupDisplayPermission Created\n")
def delete_empty_group_display_permission(apps, schema_editor):
gdp = apps.get_model("hmi", "GroupDisplayPermission")
g = gdp.objects.filter(hmi_group=None).delete()
if g[1]:
logger.info("Empty GroupDisplayPermission Deleted\n")
class Migration(migrations.Migration):
dependencies = [
("auth", "0012_alter_user_first_name_max_length"),
("hmi", "0071_remove_displayvalueoption_color_1_and_more"),
]
operations = [
migrations.AlterField(
model_name="groupdisplaypermission",
name="hmi_group",
field=models.OneToOneField(
blank=True,
null=True,
on_delete=django.db.models.deletion.CASCADE,
to="auth.group",
),
),
migrations.RunPython(
create_empty_group_display_permission, delete_empty_group_display_permission
),
]
================================================
FILE: pyscada/hmi/migrations/0073_alter_processflowdiagramitem_control_item.py
================================================
# Generated by Django 4.2.1 on 2023-06-05 07:57
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
("hmi", "0072_alter_groupdisplaypermission_hmi_group"),
]
operations = [
migrations.AlterField(
model_name="processflowdiagramitem",
name="control_item",
field=models.ForeignKey(
blank=True,
default=None,
null=True,
on_delete=django.db.models.deletion.CASCADE,
to="hmi.controlitem",
),
),
]
================================================
FILE: pyscada/hmi/migrations/0074_alter_cssclass_css_class.py
================================================
# Generated by Django 4.2.1 on 2023-06-15 09:56
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("hmi", "0073_alter_processflowdiagramitem_control_item"),
]
operations = [
migrations.AlterField(
model_name="cssclass",
name="css_class",
field=models.CharField(default="", max_length=250),
),
]
================================================
FILE: pyscada/hmi/migrations/0075_alter_processflowdiagram_url_height_and_more.py
================================================
# Generated by Django 4.2.1 on 2023-06-16 07:35
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("hmi", "0074_alter_cssclass_css_class"),
]
operations = [
migrations.AlterField(
model_name="processflowdiagram",
name="url_height",
field=models.PositiveIntegerField(default="100", editable=False, null=True),
),
migrations.AlterField(
model_name="processflowdiagram",
name="url_width",
field=models.PositiveIntegerField(default="100", editable=False, null=True),
),
]
================================================
FILE: pyscada/hmi/migrations/0076_displayvalueoptiontemplate_transformdata_and_more.py
================================================
# Generated by Django 4.2.5 on 2023-11-16 16:05
from django.db import migrations, models
import django.db.models.deletion
import pyscada.hmi.models
class Migration(migrations.Migration):
dependencies = [
("hmi", "0075_alter_processflowdiagram_url_height_and_more"),
]
operations = [
migrations.CreateModel(
name="DisplayValueOptionTemplate",
fields=[
(
"id",
models.AutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
("label", models.CharField(max_length=40, unique=True)),
(
"template_name",
models.CharField(
blank=True,
help_text="The template to use for the control item. Must ends with '.html'.",
max_length=100,
validators=[pyscada.hmi.models.validate_html],
),
),
(
"js_files",
models.TextField(
blank=True,
help_text="for a file in static, start without /, like : pyscada/js/pyscada/file.js
for a local file not in static, start with /, like : /test/file.js
for a remote file, indicate the url
you can provide a coma separated list",
max_length=400,
),
),
(
"css_files",
models.TextField(
blank=True,
help_text="for a file in static, start without /, like : pyscada/js/pyscada/file.js
for a local file not in static, start with /, like : /test/file.js
for a remote file, indicate the url
you can provide a coma separated list",
max_length=100,
),
),
],
),
migrations.CreateModel(
name="TransformData",
fields=[
(
"id",
models.AutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
("inline_model_name", models.CharField(max_length=100)),
("short_name", models.CharField(max_length=20)),
("js_function_name", models.CharField(max_length=100)),
(
"js_files",
models.TextField(
blank=True,
help_text="for a file in static, start without /, like : pyscada/js/pyscada/file.js
for a local file not in static, start with /, like : /test/file.js
for a remote file, indicate the url
you can provide a coma separated list",
max_length=100,
),
),
(
"css_files",
models.TextField(
blank=True,
help_text="for a file in static, start without /, like : pyscada/js/pyscada/file.js
for a local file not in static, start with /, like : /test/file.js
for a remote file, indicate the url
you can provide a coma separated list",
max_length=100,
),
),
(
"need_historical_data",
models.BooleanField(
default=False,
help_text="If true, will query the data corresponding of the date range picker.",
),
),
],
),
migrations.RenameField(
model_name="displayvalueoption",
old_name="name",
new_name="title",
),
migrations.RemoveField(
model_name="displayvalueoption",
name="type",
),
migrations.AddField(
model_name="displayvalueoption",
name="template",
field=models.ForeignKey(
blank=True,
help_text="Select a custom template to use for this control item display value option.",
null=True,
on_delete=django.db.models.deletion.CASCADE,
to="hmi.displayvalueoptiontemplate",
),
),
migrations.AddField(
model_name="displayvalueoption",
name="transform_data",
field=models.ForeignKey(
blank=True,
help_text="Select a function to transform and manipulate data before displaying it.",
null=True,
on_delete=django.db.models.deletion.CASCADE,
to="hmi.transformdata",
),
),
]
================================================
FILE: pyscada/hmi/migrations/0077_transformdatacountvalue.py
================================================
# Generated by Django 4.2.5 on 2023-11-22 10:58
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
("hmi", "0076_displayvalueoptiontemplate_transformdata_and_more"),
]
operations = [
migrations.CreateModel(
name="TransformDataCountValue",
fields=[
(
"id",
models.AutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
),
),
("value", models.FloatField()),
(
"display_value_option",
models.OneToOneField(
on_delete=django.db.models.deletion.CASCADE,
to="hmi.displayvalueoption",
),
),
],
),
]
================================================
FILE: pyscada/hmi/migrations/0078_alter_theme_base_filename_alter_theme_view_filename.py
================================================
# Generated by Django 4.2.5 on 2024-02-22 14:37
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("hmi", "0077_transformdatacountvalue"),
]
operations = [
migrations.AlterField(
model_name="theme",
name="base_filename",
field=models.CharField(
default="base",
help_text="Enter the filename without '.html'",
max_length=400,
),
),
migrations.AlterField(
model_name="theme",
name="view_filename",
field=models.CharField(
default="view",
help_text="Enter the filename without '.html'",
max_length=400,
),
),
]
================================================
FILE: pyscada/hmi/migrations/0079_displayvalueoption_from_timestamp_offset.py
================================================
# Generated by Django 5.0.3 on 2024-07-01 12:34
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("hmi", "0078_alter_theme_base_filename_alter_theme_view_filename"),
]
operations = [
migrations.AddField(
model_name="displayvalueoption",
name="from_timestamp_offset",
field=models.PositiveSmallIntegerField(
blank=True,
default=None,
help_text="Manage the value to be displayed if there is no data within the specified time interval.
If the field is empty, the last known data before the specified time interval will be displayed.
Set a value to add an offset in milliseconds before the start of the specified time interval.",
null=True,
),
),
]
================================================
FILE: pyscada/hmi/migrations/0080_view_default_time_delta.py
================================================
# Generated by Django 5.0.3 on 2024-07-02 07:53
import datetime
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("hmi", "0079_displayvalueoption_from_timestamp_offset"),
]
operations = [
migrations.AddField(
model_name="view",
name="default_time_delta",
field=models.DurationField(default=datetime.timedelta(seconds=7200)),
),
]
================================================
FILE: pyscada/hmi/migrations/0081_groupdisplaypermission_unauthenticated_users.py
================================================
# Generated by Django 5.2.9 on 2026-01-13 08:55
from django.db import migrations, models
import django.db.models.deletion
from django.db.models.fields.related import OneToOneRel
import logging
logger = logging.getLogger(__name__)
def create_unauthenticated_users_group_display_permission(apps, schema_editor):
gdp = apps.get_model("hmi", "GroupDisplayPermission")
g = gdp.objects.get_or_create(hmi_group=None, unauthenticated_users=True)
if g[1]:
logger.info("Unauthenticated users GroupDisplayPermission Created\n")
def delete_unauthenticated_users_group_display_permission(apps, schema_editor):
gdp = apps.get_model("hmi", "GroupDisplayPermission")
g = gdp.objects.filter(hmi_group=None, unauthenticated_users=True).delete()
if g[1]:
logger.info("Unauthenticated users GroupDisplayPermission Deleted\n")
class Migration(migrations.Migration):
dependencies = [
("hmi", "0080_view_default_time_delta"),
]
operations = [
migrations.AddField(
model_name="groupdisplaypermission",
name="unauthenticated_users",
field=models.BooleanField(default=False),
),
migrations.RunPython(
create_unauthenticated_users_group_display_permission, delete_unauthenticated_users_group_display_permission
),
]
================================================
FILE: pyscada/hmi/migrations/0082_externalview.py
================================================
# Generated by Django 5.2.10 on 2026-02-04 11:10
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('hmi', '0081_groupdisplaypermission_unauthenticated_users'),
]
operations = [
migrations.CreateModel(
name='ExternalView',
fields=[
('id', models.AutoField(primary_key=True, serialize=False)),
('title', models.CharField(default='', max_length=400)),
('description', models.TextField(default='', null=True, verbose_name='Description')),
('url', models.URLField()),
('logo', models.ImageField(blank=True, upload_to='img/', verbose_name='Overview Picture')),
('visible', models.BooleanField(default=True)),
('position', models.PositiveSmallIntegerField(default=0)),
],
options={
'ordering': ['position'],
},
),
]
================================================
FILE: pyscada/hmi/migrations/0083_externalviewgroupdisplaypermission.py
================================================
# Generated by Django 5.2.10 on 2026-02-04 17:01
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('hmi', '0082_externalview'),
]
operations = [
migrations.CreateModel(
name='ExternalViewGroupDisplayPermission',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('type', models.PositiveSmallIntegerField(choices=[(0, 'allow'), (1, 'exclude')], default=0, help_text='If allow: only selected items can be seen by the group.
If exclude: allows all items except the selected ones.')),
('external_view', models.ManyToManyField(blank=True, related_name='groupdisplaypermission', to='hmi.externalview')),
('group_display_permission', models.OneToOneField(null=True, on_delete=django.db.models.deletion.CASCADE, to='hmi.groupdisplaypermission')),
],
),
]
================================================
FILE: pyscada/hmi/migrations/__init__.py
================================================
================================================
FILE: pyscada/hmi/models.py
================================================
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from pyscada.models import Device, Variable, VariableProperty, Color
from pyscada.utils import (
_get_objects_for_html as get_objects_for_html,
get_group_display_permission_list,
)
from django.template.exceptions import TemplateDoesNotExist, TemplateSyntaxError
from django.db import models
from django.contrib.auth.models import Group
from django.template.loader import get_template
from django.core.validators import MinValueValidator, MaxValueValidator
from django.core.exceptions import ValidationError
from django.utils.translation import gettext_lazy as _
from django.db.models.query import QuerySet
from django.db.utils import ProgrammingError
from django.conf import settings
from django.forms.models import BaseInlineFormSet
from asgiref.sync import sync_to_async
from datetime import timedelta
from six import text_type
import traceback
from uuid import uuid4
import logging
import json
logger = logging.getLogger(__name__)
def _delete_widget_content(sender, instance, **kwargs):
"""
delete the widget content instance when a WidgetContentModel is deleted
"""
if not issubclass(sender, WidgetContentModel):
return
# delete WidgetContent Entry
wcs = WidgetContent.objects.filter(
content_pk=instance.pk,
content_model=("%s" % instance.__class__)
.replace("", ""),
)
for wc in wcs:
logger.debug("delete wc %r" % wc)
wc.delete()
def _create_widget_content(sender, instance, created=False, **kwargs):
"""
create a widget content instance when a WidgetContentModel is deleted
"""
if not issubclass(sender, WidgetContentModel):
return
# create a WidgetContent Entry
if created:
instance.create_widget_content_entry()
else:
instance.update_widget_content_entry()
return
# raise a ValidationError if value not endswith .html or if template not found
def validate_html(value):
if not value.endswith(".html"):
raise ValidationError(
_("%(value)s should ends with '.html'"),
params={"value": value},
)
try:
get_template(value)
except TemplateDoesNotExist:
raise ValidationError(
_("%(value)s template does not exist."),
params={"value": value},
)
# return a list of files from a coma separated string
# if :// not in the file name and the filename is not starting with /, add the static url
def get_js_or_css_set_from_str(self, field):
result = list()
if not hasattr(self, field):
logger.warning(f"{field} not in {self}")
return result
files = getattr(self, field)
for file in files.split(","):
if file == "":
continue
if not file.startswith("/") and "://" not in file:
STATIC_URL = (
str(settings.STATIC_URL)
if hasattr(settings, "STATIC_URL")
else "/static/"
)
result.append(STATIC_URL + file)
else:
result.append(file)
return result
class WidgetContentModel(models.Model):
@classmethod
def __init_subclass__(cls, **kwargs):
super(WidgetContentModel, cls).__init_subclass__(**kwargs)
models.signals.post_save.connect(_create_widget_content, sender=cls)
models.signals.pre_delete.connect(_delete_widget_content, sender=cls)
def gen_html(self, **kwargs):
"""
:return: main panel html and sidebar html as
"""
logger.info(f"gen_html function of {self} model needs to be overwritten")
return None, None, {}
def _get_objects_for_html(
self, list_to_append=None, obj=None, exclude_model_names=None
):
if obj is None:
obj = self
return get_objects_for_html(
list_to_append=list_to_append,
obj=obj,
exclude_model_names=exclude_model_names,
)
def add_custom_fields_list(self, opts):
return opts
def add_exclude_fields_list(self, opts):
return opts
def create_widget_content_entry(self):
def fullname(o):
return o.__module__ + "." + o.__class__.__name__
wc = WidgetContent(
content_pk=self.pk, content_model=fullname(self), content_str=self.__str__()
)
wc.save()
def update_widget_content_entry(self):
def fullname(o):
return o.__module__ + "." + o.__class__.__name__
self.delete_duplicates()
wc = WidgetContent.objects.get(content_pk=self.pk, content_model=fullname(self))
wc.content_str = self.__str__()
wc.save()
def get_widget_content_entry(self):
def fullname(o):
return o.__module__ + "." + o.__class__.__name__
try:
return WidgetContent.objects.get(
content_pk=self.pk,
content_model=fullname(self),
content_str=self.__str__(),
)
except WidgetContent.DoesNotExist:
logger.warning(f"Widget content not found for {self}")
return None
def delete_duplicates(self):
for i in WidgetContent.objects.all():
c = WidgetContent.objects.filter(
content_pk=i.content_pk, content_model=i.content_model
).count()
if c > 1:
logger.debug(
"%s WidgetContent for %s ( %s )"
% (c, i.content_model, i.content_pk)
)
for j in range(0, c - 1):
WidgetContent.objects.filter(
content_pk=i.content_pk, content_model=i.content_model
)[j].delete()
def check_visible_object(self, visible_models_lists):
visible_model_list_str = f"visible_{self._meta.object_name.lower()}_list"
if visible_model_list_str in visible_models_lists:
visible_list = visible_models_lists[visible_model_list_str]
else:
return True
if type(visible_list) == QuerySet and self.pk in visible_list:
return True
return False
def data_objects(self, user):
# used to get all objects which need to retrive data
logger.info(f"data_objects function of {self} model should be overwritten")
return {}
class Meta:
abstract = True
class Theme(models.Model):
name = models.CharField(max_length=400)
base_filename = models.CharField(
max_length=400,
default="base",
help_text="Enter the filename without '.html'",
)
view_filename = models.CharField(
max_length=400,
default="view",
help_text="Enter the filename without '.html'",
)
def __str__(self):
return self.name
def check_all_themes(self):
# Delete theme with missing template file
for theme in Theme.objects.all():
try:
get_template(theme.base_filename + ".html")
get_template(theme.view_filename + ".html")
except TemplateDoesNotExist as e:
logger.info(f"Template {e} not found. {self} will be delete.")
theme.delete()
else:
try:
get_template(theme.view_filename + ".html").render(
{"base_html": theme.base_filename + ".html"}
)
except TemplateDoesNotExist as e:
logger.info(
f"Template {e} used in the view as base_html not found. {self} will be delete."
)
theme.delete()
except TemplateSyntaxError as e:
logger.info(e)
except AttributeError:
pass
class ControlElementOption(models.Model):
name = models.CharField(max_length=400)
placeholder = models.CharField(max_length=30, default="Enter a value")
dropdown = models.BooleanField(
default=False,
help_text="Show control item as dropdown. The variable must have a dictionary",
)
empty_dropdown_value = models.BooleanField(
default=False,
help_text="If true, show placeholder as " "default unelectable text",
)
def __str__(self):
return self.name
def get_js(self):
files = list()
return files
def get_css(self):
files = list()
return files
def get_daterangepicker(self):
return False
def get_timeline(self):
return False
class TransformData(models.Model):
inline_model_name = models.CharField(max_length=100)
short_name = models.CharField(max_length=20)
js_function_name = models.CharField(max_length=100)
js_files = models.TextField(
max_length=100,
blank=True,
help_text="for a file in static, start without /, like : pyscada/js/pyscada/file.js
for a local file not in static, start with /, like : /test/file.js
for a remote file, indicate the url
you can provide a coma separated list",
)
css_files = models.TextField(
max_length=100,
blank=True,
help_text="for a file in static, start without /, like : pyscada/js/pyscada/file.js
for a local file not in static, start with /, like : /test/file.js
for a remote file, indicate the url
you can provide a coma separated list",
)
need_historical_data = models.BooleanField(
default=False,
help_text="If true, will query the data corresponding of the date range picker.",
)
def __str__(self):
return self.short_name
def get_js(self):
return get_js_or_css_set_from_str(self, "js_files")
def get_css(self):
return get_js_or_css_set_from_str(self, "css_files")
class DisplayValueOptionTemplate(models.Model):
label = models.CharField(max_length=40, unique=True)
template_name = models.CharField(
max_length=100,
blank=True,
help_text="The template to use for the control item. Must ends with '.html'.",
validators=[validate_html],
)
js_files = models.TextField(
max_length=400,
blank=True,
help_text="for a file in static, start without /, like : pyscada/js/pyscada/file.js
for a local file not in static, start with /, like : /test/file.js
for a remote file, indicate the url
you can provide a coma separated list",
)
css_files = models.TextField(
max_length=100,
blank=True,
help_text="for a file in static, start without /, like : pyscada/js/pyscada/file.js
for a local file not in static, start with /, like : /test/file.js
for a remote file, indicate the url
you can provide a coma separated list",
)
def __str__(self):
return self.label
def get_js(self):
return get_js_or_css_set_from_str(self, "js_files")
def get_css(self):
return get_js_or_css_set_from_str(self, "css_files")
# return the template name or template_not_found.html if the template is not found
def get_template_name(self):
try:
validate_html(self.template_name)
return self.template_name
except ValidationError as e:
logger.warning(e)
return "template_not_found.html"
class DisplayValueOption(models.Model):
title = models.CharField(max_length=400)
template = models.ForeignKey(
DisplayValueOptionTemplate,
null=True,
blank=True,
on_delete=models.CASCADE,
help_text="Select a custom template to use for this control item display value option.",
)
color = models.ForeignKey(
Color,
null=True,
blank=True,
on_delete=models.CASCADE,
help_text="Default color if no level defined, can be null.
"
"Color < or =< first level, if a level is defined.",
)
color_only = models.BooleanField(
default=False, help_text="If true, will not display the value."
)
gradient = models.BooleanField(
default=False, help_text="Need 1 color option to be defined."
)
gradient_higher_level = models.FloatField(
default=0, help_text="Color defined above will be used for this level."
)
timestamp_conversion_choices = (
(0, "None"),
(1, "Timestamp in milliseconds to local date"),
(2, "Timestamp in milliseconds to local time"),
(3, "Timestamp in milliseconds to local date and time"),
(4, "Timestamp in seconds to local date"),
(5, "Timestamp in seconds to local time"),
(6, "Timestamp in seconds to local date and time"),
)
timestamp_conversion = models.PositiveSmallIntegerField(
default=0, choices=timestamp_conversion_choices
)
transform_data = models.ForeignKey(
TransformData,
null=True,
blank=True,
on_delete=models.CASCADE,
help_text="Select a function to transform and manipulate data before displaying it.",
)
from_timestamp_offset = models.PositiveSmallIntegerField(
default=None,
blank=True,
null=True,
help_text="Manage the value to be displayed if there is no data within the specified time interval.
"
"If the field is empty, the last known data before the specified time interval will be displayed.
"
"Set a value to add an offset in milliseconds before the start of the specified time interval.",
)
def __str__(self):
return self.title
def _get_objects_for_html(
self, list_to_append=None, obj=None, exclude_model_names=None
):
list_to_append = get_objects_for_html(list_to_append, self, exclude_model_names)
for item in self.displayvaluecoloroption_set.all():
list_to_append = get_objects_for_html(
list_to_append, item, ["display_value_option"]
)
return list_to_append
def get_js(self):
files = list()
if self.transform_data is not None:
js_files = self.transform_data.get_js()
if type(js_files) == list:
files += js_files
elif type(js_files) == str:
files.append(js_files)
if self.template is not None:
js_files = self.template.get_js()
if type(js_files) == list:
files += js_files
elif type(js_files) == str:
files.append(js_files)
return files
def get_css(self):
files = list()
if self.transform_data is not None:
css_files = self.transform_data.get_css()
if type(css_files) == list:
files += css_files
elif type(css_files) == str:
files.append(css_files)
if self.template is not None:
css_files = self.template.get_css()
if type(css_files) == list:
files += css_files
elif type(css_files) == str:
files.append(css_files)
return files
def get_daterangepicker(self):
if self.transform_data is not None:
return self.transform_data.need_historical_data
def get_timeline(self):
if self.transform_data is not None:
return self.transform_data.need_historical_data
class DisplayValueColorOption(models.Model):
display_value_option = models.ForeignKey(
DisplayValueOption, on_delete=models.CASCADE
)
color_level = models.FloatField()
color_level_type_choices = (
(0, "color =< level"),
(1, "color < level"),
)
color_level_type = models.PositiveSmallIntegerField(
default=0, choices=color_level_type_choices
)
color = models.ForeignKey(
Color,
null=True,
blank=True,
on_delete=models.CASCADE,
help_text="Let blank for no color below the selected level.",
)
class Meta:
constraints = [
models.UniqueConstraint(
fields=["display_value_option", "color_level", "color_level_type"],
name="unique_display_value_color_option",
)
]
ordering = ["color_level", "-color_level_type"]
class TransformDataCountValue(models.Model):
display_value_option = models.OneToOneField(
DisplayValueOption, on_delete=models.CASCADE
)
value = models.FloatField() # the value to count
class FormSet(BaseInlineFormSet):
def clean(self):
super().clean()
# get the formset model name, here TransformDataCountValue
class_name = self.model.__name__
# check if a transform data has been selected in the admin and if a transform data exist with this id
if (
self.data["transform_data"] != ""
and TransformData.objects.get(id=self.data["transform_data"])
is not None
):
# get the selected transform data inline model name
transform_data_name = TransformData.objects.get(
id=self.data["transform_data"]
).inline_model_name
# if the selected transform data inline model name is this model, check if the value field has been filled in
# otherwhise raise a ValidationError
if (
class_name == transform_data_name
and self.data[transform_data_name.lower() + "-0-value"] == ""
and self.data["transform_data"] != ""
):
raise ValidationError("Value is required.")
class ControlItem(models.Model):
id = models.AutoField(primary_key=True)
label = models.CharField(max_length=400, default="")
position = models.PositiveSmallIntegerField(default=0)
type_choices = (
(0, "Control Element"),
(1, "Display Value"),
)
type = models.PositiveSmallIntegerField(default=0, choices=type_choices)
variable = models.ForeignKey(
Variable, null=True, blank=True, on_delete=models.CASCADE
)
variable_property = models.ForeignKey(
VariableProperty, null=True, blank=True, on_delete=models.CASCADE
)
display_value_options = models.ForeignKey(
DisplayValueOption, null=True, blank=True, on_delete=models.SET_NULL
)
control_element_options = models.ForeignKey(
ControlElementOption, null=True, blank=True, on_delete=models.SET_NULL
)
class Meta:
ordering = ["position"]
def __str__(self):
type_str = ""
for i in self.type_choices:
if i[0] == self.type:
type_str = i[1]
if self.variable_property:
return (
self.id.__str__()
+ "-"
+ type_str.replace(" ", "_")
+ "-"
+ self.label.replace(" ", "_")
+ "-"
+ self.variable_property.name.replace(" ", "_")
)
elif self.variable:
return (
self.id.__str__()
+ "-"
+ type_str.replace(" ", "_")
+ "-"
+ "-"
+ self.label.replace(" ", "_")
+ "-"
+ "-"
+ self.variable.name.replace(" ", "_")
)
else:
return "Empty control item with id " + self.id.__str__()
def web_id(self):
if self.variable_property:
return (
"controlitem-"
+ self.id.__str__()
+ "-"
+ self.variable_property.id.__str__()
)
elif self.variable:
return "controlitem-" + self.id.__str__() + "-" + self.variable.id.__str__()
def web_class_str(self):
if self.variable_property:
return "prop-%d" % self.variable_property_id
elif self.variable:
return "var-%d" % self.variable_id
def active(self):
if self.variable_property:
return (
self.variable_property.variable.active
and self.variable_property.variable.device.active
)
elif self.variable:
return self.variable.active and self.variable.device.active
return False
def key(self):
if self.variable_property:
return self.variable_property_id
elif self.variable:
return self.variable_id
def name(self):
if self.variable_property:
return self.variable_property.name
elif self.variable:
return self.variable.name
def item_type(self):
if self.variable_property:
return "variable_property"
elif self.variable:
return "variable"
def unit(self):
if self.variable_property:
if self.variable_property.unit is not None:
return self.variable_property.unit.unit
else:
return ""
elif self.variable:
return self.variable.unit.unit
def min(self):
if self.variable_property:
return self.variable_property.value_min
elif self.variable:
return self.variable.value_min
def max(self):
if self.variable_property:
return self.variable_property.value_max
elif self.variable:
return self.variable.value_max
def value(self):
if self.variable_property:
return self.variable_property.value()
elif self.variable:
self.variable.query_prev_value()
return self.variable.prev_value
def value_class(self):
if self.variable_property:
return self.variable_property.value_class
elif self.variable:
return self.variable.value_class
def min_type(self):
if self.variable_property:
return self.variable_property.min_type
elif self.variable:
return self.variable.min_type
def max_type(self):
if self.variable_property:
return self.variable_property.max_type
elif self.variable:
return self.variable.max_type
def device(self):
if self.variable_property:
return self.variable_property.variable.device
elif self.variable:
return self.variable.device
def threshold_values(self):
tv = dict()
if (
self.display_value_options is not None
and self.display_value_options.color is not None
):
if len(self.display_value_options.displayvaluecoloroption_set.all()) == 0:
tv["max"] = self.display_value_options.color.color_code()
else:
prev_color = self.display_value_options.color
for (
dvco
) in self.display_value_options.displayvaluecoloroption_set.all():
tv[dvco.color_level] = prev_color.color_code()
prev_color = dvco.color
tv["max"] = prev_color.color_code()
return json.dumps(tv)
def gauge_params(self):
d = dict()
d["min"] = self.min()
d["max"] = self.max()
d["threshold_values"] = self.threshold_values()
return json.dumps(d)
def dictionary(self):
if self.variable_property:
return self.variable_property.dictionary
elif self.variable:
return self.variable.dictionary
def _get_objects_for_html(
self, list_to_append=None, obj=None, exclude_model_names=None
):
list_to_append = get_objects_for_html(list_to_append, self, exclude_model_names)
return list_to_append
def get_js(self):
files = list()
if self.type == 1 and self.display_value_options is not None:
files += self.display_value_options.get_js()
if self.type == 0 and self.control_element_options is not None:
files += self.control_element_options.get_js()
return files
def get_css(self):
files = list()
if self.type == 1 and self.display_value_options is not None:
files += self.display_value_options.get_css()
if self.type == 0 and self.control_element_options is not None:
files += self.control_element_options.get_css()
return files
def get_daterangepicker(self):
if self.type == 0 and self.control_element_options is not None:
return self.control_element_options.get_daterangepicker()
elif self.type == 1 and self.display_value_options is not None:
return self.display_value_options.get_daterangepicker()
return False
def get_timeline(self):
if self.type == 0 and self.control_element_options is not None:
return self.control_element_options.get_timeline()
elif self.type == 1 and self.display_value_options is not None:
return self.display_value_options.get_timeline()
return False
def readable(self):
if self.variable_property:
return self.variable_property.variable.readable
elif self.variable:
return self.variable.readable
class Chart(WidgetContentModel):
id = models.AutoField(primary_key=True)
title = models.CharField(max_length=400, default="")
x_axis_label = models.CharField(max_length=400, default="", blank=True)
x_axis_var = models.ForeignKey(
Variable,
default=None,
related_name="x_axis_var",
null=True,
blank=True,
on_delete=models.SET_NULL,
)
x_axis_ticks = models.PositiveSmallIntegerField(default=6)
x_axis_linlog = models.BooleanField(
default=False, help_text="False->Lin / True->Log"
)
def __str__(self):
return text_type(str(self.id) + ": " + self.title)
def visible(self):
return True
def data_objects(self, user):
# used to get all objects which need to retrive data
objects = {}
for axe in self.chartaxis_set.all():
for item in axe.variables.all():
if "variable" not in objects:
objects["variable"] = []
objects["variable"].append(item.pk)
return objects
def gen_html(self, **kwargs):
"""
:return: main panel html and sidebar html as
"""
widget_pk = kwargs["widget_pk"] if "widget_pk" in kwargs else 0
widget_extra_css_class = (
kwargs["widget_extra_css_class"]
if "widget_extra_css_class" in kwargs
else ""
)
main_template = get_template("chart.html")
sidebar_template = get_template("chart_legend.html")
main_content = None
sidebar_content = None
if "visible_objects_lists" in kwargs and self.check_visible_object(
kwargs["visible_objects_lists"]
):
main_content = main_template.render(
dict(
chart=self,
widget_pk=widget_pk,
widget_extra_css_class=widget_extra_css_class,
)
)
sidebar_content = sidebar_template.render(
dict(
chart=self,
widget_pk=widget_pk,
widget_extra_css_class=widget_extra_css_class,
)
)
opts = dict()
opts["show_daterangepicker"] = True
opts["show_timeline"] = True
opts["flot"] = True
# opts["object_config_list"] = set()
# opts["object_config_list"].update(self._get_objects_for_html())
return main_content, sidebar_content, opts
def _get_objects_for_html(
self, list_to_append=None, obj=None, exclude_model_names=None
):
list_to_append = super()._get_objects_for_html(
list_to_append, obj, exclude_model_names
)
if obj is None:
for axis in self.chartaxis_set.all():
list_to_append = super()._get_objects_for_html(
list_to_append, axis, ["chart"]
)
return list_to_append
class ChartAxis(models.Model):
label = models.CharField(max_length=400, default="", blank=True)
position_choices = (
(0, "left"),
(1, "right"),
)
position = models.PositiveSmallIntegerField(default=0, choices=position_choices)
min = models.FloatField(blank=True, null=True)
max = models.FloatField(blank=True, null=True)
show_bars = models.BooleanField(default=False, help_text="Show bars")
show_plot_points = models.BooleanField(
default=False, help_text="Show the plots points"
)
show_plot_lines_choices = (
(0, "No"),
(1, "Yes"),
(2, "Yes as steps"),
)
show_plot_lines = models.PositiveSmallIntegerField(
default=2, help_text="Show the plot lines", choices=show_plot_lines_choices
)
stack = models.BooleanField(
default=False, help_text="Stack all variables of this axis"
)
fill = models.BooleanField(
default=False, help_text="Fill all variables of this axis"
)
variables = models.ManyToManyField(Variable)
chart = models.ForeignKey(Chart, on_delete=models.CASCADE)
class Meta:
verbose_name = "Y Axis"
verbose_name_plural = "Y Axis"
class Pie(WidgetContentModel):
id = models.AutoField(primary_key=True)
title = models.CharField(max_length=400, default="")
radius = models.PositiveSmallIntegerField(
default=100, validators=[MaxValueValidator(100), MinValueValidator(1)]
)
innerRadius = models.PositiveSmallIntegerField(
default=0, validators=[MaxValueValidator(100), MinValueValidator(0)]
)
variables = models.ManyToManyField(Variable, blank=True)
variable_properties = models.ManyToManyField(VariableProperty, blank=True)
def __str__(self):
return text_type(str(self.id) + ": " + self.title)
def visible(self):
return True
def data_objects(self, user):
# used to get all objects which need to retrive data
objects = {}
for item in self.variables.all():
if "variable" not in objects:
objects["variable"] = []
objects["variable"].append(item.pk)
for item in self.variable_properties.all():
if "variable_property" not in objects:
objects["variable_property"] = []
objects["variable_property"].append(item.pk)
return objects
def gen_html(self, **kwargs):
"""
:return: main panel html and sidebar html as
"""
widget_pk = kwargs["widget_pk"] if "widget_pk" in kwargs else 0
widget_extra_css_class = (
kwargs["widget_extra_css_class"]
if "widget_extra_css_class" in kwargs
else ""
)
main_template = get_template("pie.html")
sidebar_template = get_template("chart_legend.html")
main_content = None
sidebar_content = None
if "visible_objects_lists" in kwargs and self.check_visible_object(
kwargs["visible_objects_lists"]
):
main_content = main_template.render(
dict(
pie=self,
widget_pk=widget_pk,
widget_extra_css_class=widget_extra_css_class,
)
)
sidebar_content = sidebar_template.render(
dict(
chart=self,
pie=1,
widget_pk=widget_pk,
widget_extra_css_class=widget_extra_css_class,
)
)
opts = dict()
opts["flot"] = True
opts["topbar"] = True
return main_content, sidebar_content, opts
class Form(models.Model):
id = models.AutoField(primary_key=True)
title = models.CharField(max_length=400, default="")
button = models.CharField(max_length=50, default="Ok")
control_items = models.ManyToManyField(
ControlItem,
related_name="control_items_form",
limit_choices_to={"type": "0"},
blank=True,
)
hidden_control_items_to_true = models.ManyToManyField(
ControlItem,
related_name="hidden_control_items_form",
limit_choices_to={"type": "0"},
blank=True,
)
def __str__(self):
return text_type(str(self.id) + ": " + self.title)
def visible(self):
return True
def web_id(self):
return "form-" + self.id.__str__()
def control_items_list(self):
return [item.pk for item in self.control_items]
def hidden_control_items_to_true_list(self):
return [item.pk for item in self.hidden_control_items_to_true]
def get_js(self):
files = list()
for item in self.control_items.all():
files += item.get_js()
for item in self.hidden_control_items_to_true.all():
files += item.get_js()
return files
def get_css(self):
files = list()
for item in self.control_items.all():
files += item.get_css()
for item in self.hidden_control_items_to_true.all():
files += item.get_css()
return files
def get_daterangepicker(self):
get_daterangepicker = False
for item in self.control_items.all():
get_daterangepicker = get_daterangepicker or item.get_daterangepicker()
for item in self.hidden_control_items_to_true.all():
get_daterangepicker = get_daterangepicker or item.get_daterangepicker()
return get_daterangepicker
def get_timeline(self):
get_timeline = False
for item in self.control_items.all():
get_timeline = get_timeline or item.get_timeline()
for item in self.hidden_control_items_to_true.all():
get_timeline = get_timeline or item.get_timeline()
return get_timeline
class Page(models.Model):
id = models.AutoField(primary_key=True)
title = models.CharField(max_length=400, default="")
link_title = models.SlugField(max_length=80, default="")
position = models.PositiveSmallIntegerField(default=0)
class Meta:
ordering = ["position"]
def __str__(self):
return self.link_title.replace(" ", "_")
def data_objects(self, user):
# used to get all objects which need to retrive data
objects = {}
groups = user.groups.all() if user is not None else []
authenticated = True if user is not None else False
for w in get_group_display_permission_list(
self.widget_set.filter(visible=True), groups, authenticated
):
wdo = w.data_objects(user)
for o in wdo.keys():
if o not in objects:
objects[o] = []
objects[o] = list(set(objects[o] + wdo.get(o, [])))
return objects
class ControlPanel(WidgetContentModel):
id = models.AutoField(primary_key=True)
title = models.CharField(max_length=400, default="")
items = models.ManyToManyField(ControlItem, blank=True)
forms = models.ManyToManyField(Form, blank=True)
def __str__(self):
return str(self.id) + ": " + self.title
def data_objects(self, user):
# used to get all objects which need to retrive data
objects = {}
groups = user.groups.all() if user is not None else []
authenticated = True if user is not None else False
for ci in get_group_display_permission_list(
self.items.all(), groups, authenticated
):
if ci.item_type() not in objects:
objects[ci.item_type()] = []
objects[ci.item_type()].append(ci.key())
if ci.type == 0:
# accessible in writing
if f"{ci.item_type()}_write" not in objects:
objects[f"{ci.item_type()}_write"] = []
objects[f"{ci.item_type()}_write"].append(ci.key())
for form in get_group_display_permission_list(
self.forms.all(), groups, authenticated
):
for ci in get_group_display_permission_list(
form.control_items.all(), groups, authenticated
):
if ci.item_type() not in objects:
objects[ci.item_type()] = []
objects[ci.item_type()].append(ci.key())
if ci.type == 0:
# accessible in writing
if f"{ci.item_type()}_write" not in objects:
objects[f"{ci.item_type()}_write"] = []
objects[f"{ci.item_type()}_write"].append(ci.key())
for ci in get_group_display_permission_list(
form.hidden_control_items_to_true.all(), groups, authenticated
):
if ci.item_type() not in objects:
objects[ci.item_type()] = []
objects[ci.item_type()].append(ci.key())
if ci.type == 0:
# accessible in writing
if f"{ci.item_type()}_write" not in objects:
objects[f"{ci.item_type()}_write"] = []
objects[f"{ci.item_type()}_write"].append(ci.key())
return objects
def gen_html(self, **kwargs):
"""
:return: main panel html and sidebar html as
"""
widget_pk = kwargs["widget_pk"] if "widget_pk" in kwargs else 0
widget_extra_css_class = (
kwargs["widget_extra_css_class"]
if "widget_extra_css_class" in kwargs
else ""
)
main_template = get_template("control_panel.html")
main_content = None
if "visible_objects_lists" in kwargs and self.check_visible_object(
kwargs["visible_objects_lists"]
):
visible_element_list = (
kwargs["visible_objects_lists"]["visible_controlitem_list"]
if "visible_controlitem_list" in kwargs["visible_objects_lists"]
else []
)
visible_form_list = (
kwargs["visible_objects_lists"]["visible_form_list"]
if "visible_form_list" in kwargs["visible_objects_lists"]
else []
)
main_content = main_template.render(
dict(
control_panel=self,
visible_control_element_list=visible_element_list,
visible_form_list=visible_form_list,
uuid=uuid4().hex,
widget_pk=widget_pk,
widget_extra_css_class=widget_extra_css_class,
)
)
sidebar_content = None
opts = dict()
opts["flot"] = False
opts["javascript_files_list"] = list()
opts["css_files_list"] = list()
opts["show_daterangepicker"] = False
opts["show_timeline"] = False
for item in self.items.all():
opts["javascript_files_list"] += item.get_js()
opts["css_files_list"] += item.get_css()
opts["show_daterangepicker"] = (
opts["show_daterangepicker"] or item.get_daterangepicker()
)
opts["show_timeline"] = opts["show_timeline"] or item.get_timeline()
for form in self.forms.all():
opts["javascript_files_list"] += form.get_js()
opts["css_files_list"] += form.get_css()
opts["show_daterangepicker"] = (
opts["show_daterangepicker"] or form.get_daterangepicker()
)
opts["show_timeline"] = opts["show_timeline"] or form.get_timeline()
# opts["object_config_list"] = set()
# opts["object_config_list"].update(self._get_objects_for_html())
# opts = self.add_custom_fields_list(opts)
return main_content, sidebar_content, opts
def add_custom_fields_list(self, opts):
if type(opts) == dict:
if "custom_fields_list" not in opts:
opts["custom_fields_list"] = dict()
opts["custom_fields_list"]["variable"] = [
{"name": "refresh-requested-timestamp", "value": ""},
{"name": "value-timestamp", "value": ""},
]
opts["custom_fields_list"]["variableproperty"] = [
{"name": "refresh-requested-timestamp", "value": ""},
{"name": "value-timestamp", "value": ""},
]
return opts
class CustomHTMLPanel(WidgetContentModel):
id = models.AutoField(primary_key=True)
title = models.CharField(max_length=400, default="", blank=True)
html = models.TextField()
variables = models.ManyToManyField(Variable, blank=True)
variable_properties = models.ManyToManyField(VariableProperty, blank=True)
def __str__(self):
return str(self.id) + ": " + self.title
def data_objects(self, user):
# used to get all objects which need to retrive data
objects = {}
for variable in self.variables.all():
if "variable" not in objects:
objects["variable"] = []
objects["variable"].append(variable.pk)
for variable_property in self.variable_properties.all():
if "variable_property" not in objects:
objects["variable_property"] = []
objects["variable_property"].append(variable_property.pk)
return objects
def gen_html(self, **kwargs):
"""
:return: main panel html and sidebar html as
"""
widget_pk = kwargs["widget_pk"] if "widget_pk" in kwargs else 0
widget_extra_css_class = (
kwargs["widget_extra_css_class"]
if "widget_extra_css_class" in kwargs
else ""
)
main_template = get_template("custom_html_panel.html")
main_content = None
if "visible_objects_lists" in kwargs and self.check_visible_object(
kwargs["visible_objects_lists"]
):
main_content = main_template.render(
dict(
custom_html_panel=self,
widget_pk=widget_pk,
widget_extra_css_class=widget_extra_css_class,
)
)
sidebar_content = None
opts = dict()
# opts["object_config_list"] = set()
# opts["object_config_list"].update(self._get_objects_for_html())
return main_content, sidebar_content, opts
class ProcessFlowDiagramItem(models.Model):
id = models.AutoField(primary_key=True)
control_item = models.ForeignKey(
ControlItem, default=None, blank=True, null=True, on_delete=models.CASCADE
)
top = models.PositiveIntegerField(blank=True, default=0)
left = models.PositiveIntegerField(blank=True, default=0)
font_size = models.PositiveSmallIntegerField(default=14)
width = models.PositiveIntegerField(blank=True, default=0)
height = models.PositiveIntegerField(blank=True, default=0)
visible = models.BooleanField(default=True)
def __str__(self):
if self.control_item:
if self.control_item.label != "":
return str(self.id) + ": " + self.control_item.label
else:
return str(self.id) + ": " + self.control_item.name
else:
return str(self.id)
class ProcessFlowDiagram(WidgetContentModel):
id = models.AutoField(primary_key=True)
title = models.CharField(max_length=400, default="", blank=True)
background_image = models.ImageField(
upload_to="img/",
height_field="url_height",
width_field="url_width",
verbose_name="background image",
blank=True,
)
type_choices = (
(0, "HTML"),
(1, "SVG"),
)
type = models.PositiveSmallIntegerField(
default=0,
choices=type_choices,
help_text="HTML is not responsive and can display control element
"
"SVG is responsive and cannot display control element",
)
process_flow_diagram_items = models.ManyToManyField(
ProcessFlowDiagramItem, blank=True
)
url_height = models.PositiveIntegerField(editable=False, default="100", null=True)
url_width = models.PositiveIntegerField(editable=False, default="100", null=True)
def __str__(self):
if self.title:
return str(self.id) + ": " + self.title
else:
return str(self.id) + ": " + self.background_image.name
def data_objects(self, user):
# used to get all objects which need to retrive data
objects = {}
groups = user.groups.all() if user is not None else []
authenticated = True if user is not None else False
for pfdi in self.process_flow_diagram_items.all():
if (
pfdi.control_item is not None
and pfdi.visible
and pfdi.control_item
in get_group_display_permission_list(
ControlItem.objects.all(), groups, authenticated
)
):
if pfdi.control_item.item_type() not in objects:
objects[pfdi.control_item.item_type()] = []
objects[pfdi.control_item.item_type()].append(pfdi.control_item.key())
if pfdi.control_item.type == 0:
# accessible in writing
if f"{pfdi.control_item.item_type()}_write" not in objects:
objects[f"{pfdi.control_item.item_type()}_write"] = []
objects[f"{pfdi.control_item.item_type()}_write"].append(
pfdi.control_item.key()
)
return objects
def gen_html(self, **kwargs):
"""
:return: main panel html and sidebar html as
"""
main_template = get_template("process_flow_diagram.html")
try:
widget_pk = kwargs["widget_pk"] if "widget_pk" in kwargs else 0
widget_extra_css_class = (
kwargs["widget_extra_css_class"]
if "widget_extra_css_class" in kwargs
else ""
)
main_content = None
if "visible_objects_lists" in kwargs and self.check_visible_object(
kwargs["visible_objects_lists"]
):
main_content = main_template.render(
dict(
process_flow_diagram=self,
height_width_ratio=100
* float(self.url_height)
/ float(self.url_width),
uuid=uuid4().hex,
widget_pk=widget_pk,
widget_extra_css_class=widget_extra_css_class,
)
)
except ValueError:
logger.info(f"ProcessFlowDiagram {self} has no background image defined")
except FileNotFoundError as e:
logger.info(f"ProcessFlowDiagram {self} : {e}")
sidebar_content = None
opts = dict()
# opts["object_config_list"] = set()
# opts["object_config_list"].update(self._get_objects_for_html())
return main_content, sidebar_content, opts
class SlidingPanelMenu(models.Model):
id = models.AutoField(primary_key=True)
title = models.CharField(max_length=400, default="")
position_choices = ((0, "Control Menu"), (1, "left"), (2, "right"))
position = models.PositiveSmallIntegerField(default=0, choices=position_choices)
control_panel = models.ForeignKey(
ControlPanel, blank=True, null=True, default=None, on_delete=models.SET_NULL
)
visible = models.BooleanField(default=True)
def __str__(self):
return self.title
def data_objects(self, user):
# used to get all objects which need to retrive data
if self.control_panel is not None:
return self.control_panel.data_objects(user)
return {}
class WidgetContent(models.Model):
content_model = models.CharField(max_length=400)
content_pk = models.PositiveIntegerField()
content_str = models.CharField(default="", max_length=400)
def create_panel_html(self, **kwargs):
"""
return main_content, sidebar_content, optional list
"""
content_model = self._import_content_model()
try:
if content_model is not None:
return content_model.gen_html(**kwargs)
else:
logger.info(
f"WidgetContent content_model of {self.content_str} is None"
)
return "", "", ""
except:
logger.error(f"{content_model} unhandled exception", exc_info=True)
# todo del self
return "", "", ""
def get_hidden_config2(self, **kwargs):
"""
return main_content, sidebar_content, optional list
"""
content_model = self._import_content_model()
opts = dict()
opts["object_config_list"] = set()
try:
if content_model is not None:
opts["object_config_list"].update(content_model._get_objects_for_html())
opts = content_model.add_custom_fields_list(opts)
opts = content_model.add_exclude_fields_list(opts)
else:
logger.info(
f"WidgetContent content_model of {self.content_str} is None"
)
except:
logger.error(f"{content_model} unhandled exception", exc_info=True)
# todo del self
return opts
def _import_content_model(self):
content_class_str = self.content_model
class_name = content_class_str.split(".")[-1]
class_path = content_class_str.replace("." + class_name, "")
try:
mod = __import__(class_path, fromlist=[class_name.__str__()])
content_class = getattr(mod, class_name.__str__())
if isinstance(content_class, models.base.ModelBase):
return content_class.objects.get(pk=self.content_pk)
except ModuleNotFoundError:
logger.info(
f"{class_name} of {class_path} not found. A module is not installed ?"
)
except ProgrammingError as e:
logger.info(
f"{e} A module is not installed ?"
)
except:
logger.error(f"{class_path} unhandled exception", exc_info=True)
return None
def __str__(self):
return "%s [%d] %s" % (
self.content_model.split(".")[-1],
self.content_pk,
self.content_str,
) # todo add more infos
class CssClass(models.Model):
id = models.AutoField(primary_key=True)
title = models.CharField(max_length=400, default="")
css_class = models.CharField(max_length=250, default="")
def __str__(self):
return self.title
class Meta:
verbose_name_plural = "Css Classes"
class Widget(models.Model):
id = models.AutoField(primary_key=True)
title = models.CharField(max_length=400, default="", blank=True)
page = models.ForeignKey(
Page, null=True, default=None, blank=True, on_delete=models.SET_NULL
)
row_choices = (
(0, "1. row"),
(1, "2. row"),
(2, "3. row"),
(3, "4. row"),
(4, "5. row"),
(5, "6. row"),
(6, "7. row"),
(7, "8. row"),
(8, "9. row"),
(9, "10. row"),
(10, "11. row"),
(11, "12. row"),
)
row = models.PositiveSmallIntegerField(default=0, choices=row_choices)
col_choices = ((0, "1. col"), (1, "2. col"), (2, "3. col"), (3, "4. col"))
col = models.PositiveSmallIntegerField(default=0, choices=col_choices)
size_choices = (
(4, "page width"),
(3, "3/4 page width"),
(2, "1/2 page width"),
(1, "1/4 page width"),
)
size = models.PositiveSmallIntegerField(default=4, choices=size_choices)
visible = models.BooleanField(default=True)
content = models.ForeignKey(
WidgetContent, null=True, default=None, on_delete=models.SET_NULL
)
extra_css_class = models.ForeignKey(
CssClass, null=True, default=None, blank=True, on_delete=models.SET_NULL
)
class Meta:
ordering = ["row", "col"]
def __str__(self):
if self.title is not None and self.page:
return str(self.id) + ": " + self.page.title + ", " + self.title
else:
return str(self.id) + ": " + "None, None"
def data_objects(self, user):
# used to get all objects which need to retrive data
if self.content is not None:
content_model = self.content._import_content_model()
groups = user.groups.all() if user is not None else []
authenticated = True if user is not None else False
if (
content_model is not None
and hasattr(content_model, "data_objects")
and (
not hasattr(content_model, "groupdisplaypermission")
or content_model
in get_group_display_permission_list(
content_model.__class__.objects.all(), groups, authenticated
)
)
):
return content_model.data_objects(user)
return {}
def css_class(self):
widget_size = "col-xs-12 col-sm-12 col-md-12 col-lg-12"
widgets = Widget.objects.filter(
visible=True, page=self.page, row=self.row, content__isnull=False
)
if self.size == 3:
if self.col in [1, 2, 3] and len(widgets.filter(col=0)) == 0:
# no widget on same row and column 0: offset 3 on lg
widget_size = "col-xs-12 col-sm-12 col-md-12 col-lg-9 col-lg-offset-3"
else:
widget_size = "col-xs-12 col-sm-12 col-md-12 col-lg-9"
elif self.size == 2:
if self.col == 1 and len(widgets.filter(col=0)) == 0:
widget_size = "col-xs-12 col-sm-12 col-md-6 col-md-offset-3 col-lg-6 col-lg-offset-3"
elif self.col in [2, 3] and len(widgets.filter(col__in=[0, 1])) == 0:
widget_size = "col-xs-12 col-sm-12 col-md-6 col-md-offset-6 col-lg-6 col-lg-offset-6"
else:
widget_size = "col-xs-12 col-sm-12 col-md-6 col-lg-6"
elif self.size == 1:
if self.col == 1 and len(widgets.filter(col=0)) == 0:
widget_size = "col-xs-12 col-sm-6 col-md-6 col-lg-3 col-lg-offset-3"
elif self.col == 2 and len(widgets.filter(col__in=[0, 1])) == 0:
widget_size = "col-xs-12 col-sm-6 col-sm-offset-6 col-md-6 col-md-offset-6 col-lg-3 col-lg-offset-6"
elif self.col == 3 and len(widgets.filter(col__in=[0, 1, 2])) == 0:
widget_size = "col-xs-12 col-sm-6 col-sm-offset-6 col-md-6 col-md-offset-6 col-lg-3 col-lg-offset-9"
else:
widget_size = "col-xs-12 col-sm-6 col-md-6 col-lg-3"
return (
"widget_row_"
+ str(self.row)
+ " widget_col_"
+ str(self.col)
+ " "
+ widget_size
)
class View(models.Model):
id = models.AutoField(primary_key=True)
title = models.CharField(max_length=400, default="")
description = models.TextField(default="", verbose_name="Description", null=True)
link_title = models.SlugField(max_length=80, default="")
pages = models.ManyToManyField(Page)
sliding_panel_menus = models.ManyToManyField(SlidingPanelMenu, blank=True)
logo = models.ImageField(
upload_to="img/", verbose_name="Overview Picture", blank=True
)
visible = models.BooleanField(default=True)
position = models.PositiveSmallIntegerField(default=0)
show_timeline = models.BooleanField(default=True)
theme = models.ForeignKey(
Theme, blank=True, null=True, default=None, on_delete=models.SET_NULL
)
default_time_delta = models.DurationField(default=timedelta(hours=2))
def __str__(self):
return self.title
def data_objects(self, user):
# used to get all objects which need to retrive data
objects = {}
if self.visible:
groups = user.groups.all() if user is not None else []
authenticated = True if user is not None else False
for w in get_group_display_permission_list(
self.sliding_panel_menus.all(), groups, authenticated
):
wdo = w.data_objects(user)
for o in wdo.keys():
if o not in objects:
objects[o] = []
objects[o] = list(set(objects[o] + wdo.get(o, [])))
for w in get_group_display_permission_list(
self.pages.all(), groups, authenticated
):
wdo = w.data_objects(user)
for o in wdo.keys():
if o not in objects:
objects[o] = []
objects[o] = list(set(objects[o] + wdo.get(o, [])))
return objects
class Meta:
ordering = ["position"]
class ExternalView(models.Model):
id = models.AutoField(primary_key=True)
title = models.CharField(max_length=400, default="")
description = models.TextField(default="", verbose_name="Description", null=True)
url = models.URLField()
logo = models.ImageField(
upload_to="img/", verbose_name="Overview Picture", blank=True
)
visible = models.BooleanField(default=True)
position = models.PositiveSmallIntegerField(default=0)
def __str__(self):
return self.title
class Meta:
ordering = ["position"]
class GroupDisplayPermission(models.Model):
hmi_group = models.OneToOneField(
Group, blank=True, null=True, on_delete=models.CASCADE
)
unauthenticated_users = models.BooleanField(default=False)
type_choices = (
(0, "allow"),
(1, "exclude"),
)
def __str__(self):
if self.hmi_group is not None:
return self.hmi_group.name
elif not self.unauthenticated_users:
return "Users without any group"
else:
return "Unauthenticated users"
class PieGroupDisplayPermission(models.Model):
group_display_permission = models.OneToOneField(
GroupDisplayPermission, null=True, on_delete=models.CASCADE
)
type = models.PositiveSmallIntegerField(
default=0,
choices=GroupDisplayPermission.type_choices,
help_text="If allow: only selected items can be seen by the group."
"
If exclude: allows all items except the selected ones.",
)
pies = models.ManyToManyField(
Pie, blank=True, related_name="groupdisplaypermission"
)
m2m_related_model = Pie
def __str__(self):
return str(self.group_display_permission)
class PageGroupDisplayPermission(models.Model):
group_display_permission = models.OneToOneField(
GroupDisplayPermission, null=True, on_delete=models.CASCADE
)
type = models.PositiveSmallIntegerField(
default=0,
choices=GroupDisplayPermission.type_choices,
help_text="If allow: only selected items can be seen by the group."
"
If exclude: allows all items except the selected ones.",
)
pages = models.ManyToManyField(
Page, blank=True, related_name="groupdisplaypermission"
)
m2m_related_model = Page
def __str__(self):
return str(self.group_display_permission)
class SlidingPanelMenuGroupDisplayPermission(models.Model):
group_display_permission = models.OneToOneField(
GroupDisplayPermission, null=True, on_delete=models.CASCADE
)
type = models.PositiveSmallIntegerField(
default=0,
choices=GroupDisplayPermission.type_choices,
help_text="If allow: only selected items can be seen by the group."
"
If exclude: allows all items except the selected ones.",
)
sliding_panel_menus = models.ManyToManyField(
SlidingPanelMenu, blank=True, related_name="groupdisplaypermission"
)
m2m_related_model = SlidingPanelMenu
def __str__(self):
return str(self.group_display_permission)
class ChartGroupDisplayPermission(models.Model):
group_display_permission = models.OneToOneField(
GroupDisplayPermission, null=True, on_delete=models.CASCADE
)
type = models.PositiveSmallIntegerField(
default=0,
choices=GroupDisplayPermission.type_choices,
help_text="If allow: only selected items can be seen by the group."
"
If exclude: allows all items except the selected ones.",
)
charts = models.ManyToManyField(
Chart, blank=True, related_name="groupdisplaypermission"
)
m2m_related_model = Chart
def __str__(self):
return str(self.group_display_permission)
class ControlItemGroupDisplayPermission(models.Model):
group_display_permission = models.OneToOneField(
GroupDisplayPermission, null=True, on_delete=models.CASCADE
)
type = models.PositiveSmallIntegerField(
default=0,
choices=GroupDisplayPermission.type_choices,
help_text="If allow: only selected items can be seen by the group."
"
If exclude: allows all items except the selected ones.",
)
control_items = models.ManyToManyField(
ControlItem, blank=True, related_name="groupdisplaypermission"
)
m2m_related_model = ControlItem
def __str__(self):
return str(self.group_display_permission)
class FormGroupDisplayPermission(models.Model):
group_display_permission = models.OneToOneField(
GroupDisplayPermission, null=True, on_delete=models.CASCADE
)
type = models.PositiveSmallIntegerField(
default=0,
choices=GroupDisplayPermission.type_choices,
help_text="If allow: only selected items can be seen by the group."
"
If exclude: allows all items except the selected ones.",
)
forms = models.ManyToManyField(
Form, blank=True, related_name="groupdisplaypermission"
)
m2m_related_model = Form
def __str__(self):
return str(self.group_display_permission)
class WidgetGroupDisplayPermission(models.Model):
group_display_permission = models.OneToOneField(
GroupDisplayPermission, null=True, on_delete=models.CASCADE
)
type = models.PositiveSmallIntegerField(
default=0,
choices=GroupDisplayPermission.type_choices,
help_text="If allow: only selected items can be seen by the group."
"
If exclude: allows all items except the selected ones.",
)
widgets = models.ManyToManyField(
Widget, blank=True, related_name="groupdisplaypermission"
)
m2m_related_model = Widget
def __str__(self):
return str(self.group_display_permission)
class CustomHTMLPanelGroupDisplayPermission(models.Model):
group_display_permission = models.OneToOneField(
GroupDisplayPermission, null=True, on_delete=models.CASCADE
)
type = models.PositiveSmallIntegerField(
default=0,
choices=GroupDisplayPermission.type_choices,
help_text="If allow: only selected items can be seen by the group."
"
If exclude: allows all items except the selected ones.",
)
custom_html_panels = models.ManyToManyField(
CustomHTMLPanel, blank=True, related_name="groupdisplaypermission"
)
m2m_related_model = CustomHTMLPanel
def __str__(self):
return str(self.group_display_permission)
class ViewGroupDisplayPermission(models.Model):
group_display_permission = models.OneToOneField(
GroupDisplayPermission, null=True, on_delete=models.CASCADE
)
type = models.PositiveSmallIntegerField(
default=0,
choices=GroupDisplayPermission.type_choices,
help_text="If allow: only selected items can be seen by the group."
"
If exclude: allows all items except the selected ones.",
)
views = models.ManyToManyField(
View, blank=True, related_name="groupdisplaypermission"
)
m2m_related_model = View
def __str__(self):
return str(self.group_display_permission)
class ExternalViewGroupDisplayPermission(models.Model):
group_display_permission = models.OneToOneField(
GroupDisplayPermission, null=True, on_delete=models.CASCADE
)
type = models.PositiveSmallIntegerField(
default=0,
choices=GroupDisplayPermission.type_choices,
help_text="If allow: only selected items can be seen by the group."
"
If exclude: allows all items except the selected ones.",
)
external_view = models.ManyToManyField(
ExternalView, blank=True, related_name="groupdisplaypermission"
)
m2m_related_model = ExternalView
def __str__(self):
return str(self.group_display_permission)
class ProcessFlowDiagramGroupDisplayPermission(models.Model):
group_display_permission = models.OneToOneField(
GroupDisplayPermission, null=True, on_delete=models.CASCADE
)
type = models.PositiveSmallIntegerField(
default=0,
choices=GroupDisplayPermission.type_choices,
help_text="If allow: only selected items can be seen by the group."
"
If exclude: allows all items except the selected ones.",
)
process_flow_diagram = models.ManyToManyField(
ProcessFlowDiagram, blank=True, related_name="groupdisplaypermission"
)
m2m_related_model = ProcessFlowDiagram
def __str__(self):
return str(self.group_display_permission)
================================================
FILE: pyscada/hmi/signals.py
================================================
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.dispatch import receiver
from django.db.models.signals import post_save, pre_delete
import logging
logger = logging.getLogger(__name__)
# moved to hmi.models.WidgetContentModel.__init_subclass__
================================================
FILE: pyscada/hmi/static/pyscada/css/bootstrap/bootstrap-theme.css
================================================
/*!
* Bootstrap v3.4.1 (https://getbootstrap.com/)
* Copyright 2011-2019 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
*/
.btn-default,
.btn-primary,
.btn-success,
.btn-info,
.btn-warning,
.btn-danger {
text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.2);
-webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.15), 0 1px 1px rgba(0, 0, 0, 0.075);
box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.15), 0 1px 1px rgba(0, 0, 0, 0.075);
}
.btn-default:active,
.btn-primary:active,
.btn-success:active,
.btn-info:active,
.btn-warning:active,
.btn-danger:active,
.btn-default.active,
.btn-primary.active,
.btn-success.active,
.btn-info.active,
.btn-warning.active,
.btn-danger.active {
-webkit-box-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125);
box-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125);
}
.btn-default.disabled,
.btn-primary.disabled,
.btn-success.disabled,
.btn-info.disabled,
.btn-warning.disabled,
.btn-danger.disabled,
.btn-default[disabled],
.btn-primary[disabled],
.btn-success[disabled],
.btn-info[disabled],
.btn-warning[disabled],
.btn-danger[disabled],
fieldset[disabled] .btn-default,
fieldset[disabled] .btn-primary,
fieldset[disabled] .btn-success,
fieldset[disabled] .btn-info,
fieldset[disabled] .btn-warning,
fieldset[disabled] .btn-danger {
-webkit-box-shadow: none;
box-shadow: none;
}
.btn-default .badge,
.btn-primary .badge,
.btn-success .badge,
.btn-info .badge,
.btn-warning .badge,
.btn-danger .badge {
text-shadow: none;
}
.btn:active,
.btn.active {
background-image: none;
}
.btn-default {
background-image: -webkit-linear-gradient(top, #fff 0%, #e0e0e0 100%);
background-image: -o-linear-gradient(top, #fff 0%, #e0e0e0 100%);
background-image: -webkit-gradient(linear, left top, left bottom, from(#fff), to(#e0e0e0));
background-image: linear-gradient(to bottom, #fff 0%, #e0e0e0 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffffff', endColorstr='#ffe0e0e0', GradientType=0);
filter: progid:DXImageTransform.Microsoft.gradient(enabled = false);
background-repeat: repeat-x;
border-color: #dbdbdb;
text-shadow: 0 1px 0 #fff;
border-color: #ccc;
}
.btn-default:hover,
.btn-default:focus {
background-color: #e0e0e0;
background-position: 0 -15px;
}
.btn-default:active,
.btn-default.active {
background-color: #e0e0e0;
border-color: #dbdbdb;
}
.btn-default.disabled,
.btn-default[disabled],
fieldset[disabled] .btn-default,
.btn-default.disabled:hover,
.btn-default[disabled]:hover,
fieldset[disabled] .btn-default:hover,
.btn-default.disabled:focus,
.btn-default[disabled]:focus,
fieldset[disabled] .btn-default:focus,
.btn-default.disabled.focus,
.btn-default[disabled].focus,
fieldset[disabled] .btn-default.focus,
.btn-default.disabled:active,
.btn-default[disabled]:active,
fieldset[disabled] .btn-default:active,
.btn-default.disabled.active,
.btn-default[disabled].active,
fieldset[disabled] .btn-default.active {
background-color: #e0e0e0;
background-image: none;
}
.btn-primary {
background-image: -webkit-linear-gradient(top, #337ab7 0%, #265a88 100%);
background-image: -o-linear-gradient(top, #337ab7 0%, #265a88 100%);
background-image: -webkit-gradient(linear, left top, left bottom, from(#337ab7), to(#265a88));
background-image: linear-gradient(to bottom, #337ab7 0%, #265a88 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff337ab7', endColorstr='#ff265a88', GradientType=0);
filter: progid:DXImageTransform.Microsoft.gradient(enabled = false);
background-repeat: repeat-x;
border-color: #245580;
}
.btn-primary:hover,
.btn-primary:focus {
background-color: #265a88;
background-position: 0 -15px;
}
.btn-primary:active,
.btn-primary.active {
background-color: #265a88;
border-color: #245580;
}
.btn-primary.disabled,
.btn-primary[disabled],
fieldset[disabled] .btn-primary,
.btn-primary.disabled:hover,
.btn-primary[disabled]:hover,
fieldset[disabled] .btn-primary:hover,
.btn-primary.disabled:focus,
.btn-primary[disabled]:focus,
fieldset[disabled] .btn-primary:focus,
.btn-primary.disabled.focus,
.btn-primary[disabled].focus,
fieldset[disabled] .btn-primary.focus,
.btn-primary.disabled:active,
.btn-primary[disabled]:active,
fieldset[disabled] .btn-primary:active,
.btn-primary.disabled.active,
.btn-primary[disabled].active,
fieldset[disabled] .btn-primary.active {
background-color: #265a88;
background-image: none;
}
.btn-success {
background-image: -webkit-linear-gradient(top, #5cb85c 0%, #419641 100%);
background-image: -o-linear-gradient(top, #5cb85c 0%, #419641 100%);
background-image: -webkit-gradient(linear, left top, left bottom, from(#5cb85c), to(#419641));
background-image: linear-gradient(to bottom, #5cb85c 0%, #419641 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff5cb85c', endColorstr='#ff419641', GradientType=0);
filter: progid:DXImageTransform.Microsoft.gradient(enabled = false);
background-repeat: repeat-x;
border-color: #3e8f3e;
}
.btn-success:hover,
.btn-success:focus {
background-color: #419641;
background-position: 0 -15px;
}
.btn-success:active,
.btn-success.active {
background-color: #419641;
border-color: #3e8f3e;
}
.btn-success.disabled,
.btn-success[disabled],
fieldset[disabled] .btn-success,
.btn-success.disabled:hover,
.btn-success[disabled]:hover,
fieldset[disabled] .btn-success:hover,
.btn-success.disabled:focus,
.btn-success[disabled]:focus,
fieldset[disabled] .btn-success:focus,
.btn-success.disabled.focus,
.btn-success[disabled].focus,
fieldset[disabled] .btn-success.focus,
.btn-success.disabled:active,
.btn-success[disabled]:active,
fieldset[disabled] .btn-success:active,
.btn-success.disabled.active,
.btn-success[disabled].active,
fieldset[disabled] .btn-success.active {
background-color: #419641;
background-image: none;
}
.btn-info {
background-image: -webkit-linear-gradient(top, #5bc0de 0%, #2aabd2 100%);
background-image: -o-linear-gradient(top, #5bc0de 0%, #2aabd2 100%);
background-image: -webkit-gradient(linear, left top, left bottom, from(#5bc0de), to(#2aabd2));
background-image: linear-gradient(to bottom, #5bc0de 0%, #2aabd2 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff5bc0de', endColorstr='#ff2aabd2', GradientType=0);
filter: progid:DXImageTransform.Microsoft.gradient(enabled = false);
background-repeat: repeat-x;
border-color: #28a4c9;
}
.btn-info:hover,
.btn-info:focus {
background-color: #2aabd2;
background-position: 0 -15px;
}
.btn-info:active,
.btn-info.active {
background-color: #2aabd2;
border-color: #28a4c9;
}
.btn-info.disabled,
.btn-info[disabled],
fieldset[disabled] .btn-info,
.btn-info.disabled:hover,
.btn-info[disabled]:hover,
fieldset[disabled] .btn-info:hover,
.btn-info.disabled:focus,
.btn-info[disabled]:focus,
fieldset[disabled] .btn-info:focus,
.btn-info.disabled.focus,
.btn-info[disabled].focus,
fieldset[disabled] .btn-info.focus,
.btn-info.disabled:active,
.btn-info[disabled]:active,
fieldset[disabled] .btn-info:active,
.btn-info.disabled.active,
.btn-info[disabled].active,
fieldset[disabled] .btn-info.active {
background-color: #2aabd2;
background-image: none;
}
.btn-warning {
background-image: -webkit-linear-gradient(top, #f0ad4e 0%, #eb9316 100%);
background-image: -o-linear-gradient(top, #f0ad4e 0%, #eb9316 100%);
background-image: -webkit-gradient(linear, left top, left bottom, from(#f0ad4e), to(#eb9316));
background-image: linear-gradient(to bottom, #f0ad4e 0%, #eb9316 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff0ad4e', endColorstr='#ffeb9316', GradientType=0);
filter: progid:DXImageTransform.Microsoft.gradient(enabled = false);
background-repeat: repeat-x;
border-color: #e38d13;
}
.btn-warning:hover,
.btn-warning:focus {
background-color: #eb9316;
background-position: 0 -15px;
}
.btn-warning:active,
.btn-warning.active {
background-color: #eb9316;
border-color: #e38d13;
}
.btn-warning.disabled,
.btn-warning[disabled],
fieldset[disabled] .btn-warning,
.btn-warning.disabled:hover,
.btn-warning[disabled]:hover,
fieldset[disabled] .btn-warning:hover,
.btn-warning.disabled:focus,
.btn-warning[disabled]:focus,
fieldset[disabled] .btn-warning:focus,
.btn-warning.disabled.focus,
.btn-warning[disabled].focus,
fieldset[disabled] .btn-warning.focus,
.btn-warning.disabled:active,
.btn-warning[disabled]:active,
fieldset[disabled] .btn-warning:active,
.btn-warning.disabled.active,
.btn-warning[disabled].active,
fieldset[disabled] .btn-warning.active {
background-color: #eb9316;
background-image: none;
}
.btn-danger {
background-image: -webkit-linear-gradient(top, #d9534f 0%, #c12e2a 100%);
background-image: -o-linear-gradient(top, #d9534f 0%, #c12e2a 100%);
background-image: -webkit-gradient(linear, left top, left bottom, from(#d9534f), to(#c12e2a));
background-image: linear-gradient(to bottom, #d9534f 0%, #c12e2a 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffd9534f', endColorstr='#ffc12e2a', GradientType=0);
filter: progid:DXImageTransform.Microsoft.gradient(enabled = false);
background-repeat: repeat-x;
border-color: #b92c28;
}
.btn-danger:hover,
.btn-danger:focus {
background-color: #c12e2a;
background-position: 0 -15px;
}
.btn-danger:active,
.btn-danger.active {
background-color: #c12e2a;
border-color: #b92c28;
}
.btn-danger.disabled,
.btn-danger[disabled],
fieldset[disabled] .btn-danger,
.btn-danger.disabled:hover,
.btn-danger[disabled]:hover,
fieldset[disabled] .btn-danger:hover,
.btn-danger.disabled:focus,
.btn-danger[disabled]:focus,
fieldset[disabled] .btn-danger:focus,
.btn-danger.disabled.focus,
.btn-danger[disabled].focus,
fieldset[disabled] .btn-danger.focus,
.btn-danger.disabled:active,
.btn-danger[disabled]:active,
fieldset[disabled] .btn-danger:active,
.btn-danger.disabled.active,
.btn-danger[disabled].active,
fieldset[disabled] .btn-danger.active {
background-color: #c12e2a;
background-image: none;
}
.thumbnail,
.img-thumbnail {
-webkit-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.075);
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.075);
}
.dropdown-menu > li > a:hover,
.dropdown-menu > li > a:focus {
background-image: -webkit-linear-gradient(top, #f5f5f5 0%, #e8e8e8 100%);
background-image: -o-linear-gradient(top, #f5f5f5 0%, #e8e8e8 100%);
background-image: -webkit-gradient(linear, left top, left bottom, from(#f5f5f5), to(#e8e8e8));
background-image: linear-gradient(to bottom, #f5f5f5 0%, #e8e8e8 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff5f5f5', endColorstr='#ffe8e8e8', GradientType=0);
background-repeat: repeat-x;
background-color: #e8e8e8;
}
.dropdown-menu > .active > a,
.dropdown-menu > .active > a:hover,
.dropdown-menu > .active > a:focus {
background-image: -webkit-linear-gradient(top, #337ab7 0%, #2e6da4 100%);
background-image: -o-linear-gradient(top, #337ab7 0%, #2e6da4 100%);
background-image: -webkit-gradient(linear, left top, left bottom, from(#337ab7), to(#2e6da4));
background-image: linear-gradient(to bottom, #337ab7 0%, #2e6da4 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff337ab7', endColorstr='#ff2e6da4', GradientType=0);
background-repeat: repeat-x;
background-color: #2e6da4;
}
.navbar-default {
background-image: -webkit-linear-gradient(top, #ffffff 0%, #f8f8f8 100%);
background-image: -o-linear-gradient(top, #ffffff 0%, #f8f8f8 100%);
background-image: -webkit-gradient(linear, left top, left bottom, from(#ffffff), to(#f8f8f8));
background-image: linear-gradient(to bottom, #ffffff 0%, #f8f8f8 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffffff', endColorstr='#fff8f8f8', GradientType=0);
background-repeat: repeat-x;
filter: progid:DXImageTransform.Microsoft.gradient(enabled = false);
border-radius: 4px;
-webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.15), 0 1px 5px rgba(0, 0, 0, 0.075);
box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.15), 0 1px 5px rgba(0, 0, 0, 0.075);
}
.navbar-default .navbar-nav > .open > a,
.navbar-default .navbar-nav > .active > a {
background-image: -webkit-linear-gradient(top, #dbdbdb 0%, #e2e2e2 100%);
background-image: -o-linear-gradient(top, #dbdbdb 0%, #e2e2e2 100%);
background-image: -webkit-gradient(linear, left top, left bottom, from(#dbdbdb), to(#e2e2e2));
background-image: linear-gradient(to bottom, #dbdbdb 0%, #e2e2e2 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffdbdbdb', endColorstr='#ffe2e2e2', GradientType=0);
background-repeat: repeat-x;
-webkit-box-shadow: inset 0 3px 9px rgba(0, 0, 0, 0.075);
box-shadow: inset 0 3px 9px rgba(0, 0, 0, 0.075);
}
.navbar-brand,
.navbar-nav > li > a {
text-shadow: 0 1px 0 rgba(255, 255, 255, 0.25);
}
.navbar-inverse {
background-image: -webkit-linear-gradient(top, #3c3c3c 0%, #222 100%);
background-image: -o-linear-gradient(top, #3c3c3c 0%, #222 100%);
background-image: -webkit-gradient(linear, left top, left bottom, from(#3c3c3c), to(#222));
background-image: linear-gradient(to bottom, #3c3c3c 0%, #222 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff3c3c3c', endColorstr='#ff222222', GradientType=0);
background-repeat: repeat-x;
filter: progid:DXImageTransform.Microsoft.gradient(enabled = false);
border-radius: 4px;
}
.navbar-inverse .navbar-nav > .open > a,
.navbar-inverse .navbar-nav > .active > a {
background-image: -webkit-linear-gradient(top, #080808 0%, #0f0f0f 100%);
background-image: -o-linear-gradient(top, #080808 0%, #0f0f0f 100%);
background-image: -webkit-gradient(linear, left top, left bottom, from(#080808), to(#0f0f0f));
background-image: linear-gradient(to bottom, #080808 0%, #0f0f0f 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff080808', endColorstr='#ff0f0f0f', GradientType=0);
background-repeat: repeat-x;
-webkit-box-shadow: inset 0 3px 9px rgba(0, 0, 0, 0.25);
box-shadow: inset 0 3px 9px rgba(0, 0, 0, 0.25);
}
.navbar-inverse .navbar-brand,
.navbar-inverse .navbar-nav > li > a {
text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);
}
.navbar-static-top,
.navbar-fixed-top,
.navbar-fixed-bottom {
border-radius: 0;
}
@media (max-width: 767px) {
.navbar .navbar-nav .open .dropdown-menu > .active > a,
.navbar .navbar-nav .open .dropdown-menu > .active > a:hover,
.navbar .navbar-nav .open .dropdown-menu > .active > a:focus {
color: #fff;
background-image: -webkit-linear-gradient(top, #337ab7 0%, #2e6da4 100%);
background-image: -o-linear-gradient(top, #337ab7 0%, #2e6da4 100%);
background-image: -webkit-gradient(linear, left top, left bottom, from(#337ab7), to(#2e6da4));
background-image: linear-gradient(to bottom, #337ab7 0%, #2e6da4 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff337ab7', endColorstr='#ff2e6da4', GradientType=0);
background-repeat: repeat-x;
}
}
.alert {
text-shadow: 0 1px 0 rgba(255, 255, 255, 0.2);
-webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), 0 1px 2px rgba(0, 0, 0, 0.05);
box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), 0 1px 2px rgba(0, 0, 0, 0.05);
}
.alert-success {
background-image: -webkit-linear-gradient(top, #dff0d8 0%, #c8e5bc 100%);
background-image: -o-linear-gradient(top, #dff0d8 0%, #c8e5bc 100%);
background-image: -webkit-gradient(linear, left top, left bottom, from(#dff0d8), to(#c8e5bc));
background-image: linear-gradient(to bottom, #dff0d8 0%, #c8e5bc 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffdff0d8', endColorstr='#ffc8e5bc', GradientType=0);
background-repeat: repeat-x;
border-color: #b2dba1;
}
.alert-info {
background-image: -webkit-linear-gradient(top, #d9edf7 0%, #b9def0 100%);
background-image: -o-linear-gradient(top, #d9edf7 0%, #b9def0 100%);
background-image: -webkit-gradient(linear, left top, left bottom, from(#d9edf7), to(#b9def0));
background-image: linear-gradient(to bottom, #d9edf7 0%, #b9def0 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffd9edf7', endColorstr='#ffb9def0', GradientType=0);
background-repeat: repeat-x;
border-color: #9acfea;
}
.alert-warning {
background-image: -webkit-linear-gradient(top, #fcf8e3 0%, #f8efc0 100%);
background-image: -o-linear-gradient(top, #fcf8e3 0%, #f8efc0 100%);
background-image: -webkit-gradient(linear, left top, left bottom, from(#fcf8e3), to(#f8efc0));
background-image: linear-gradient(to bottom, #fcf8e3 0%, #f8efc0 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fffcf8e3', endColorstr='#fff8efc0', GradientType=0);
background-repeat: repeat-x;
border-color: #f5e79e;
}
.alert-danger {
background-image: -webkit-linear-gradient(top, #f2dede 0%, #e7c3c3 100%);
background-image: -o-linear-gradient(top, #f2dede 0%, #e7c3c3 100%);
background-image: -webkit-gradient(linear, left top, left bottom, from(#f2dede), to(#e7c3c3));
background-image: linear-gradient(to bottom, #f2dede 0%, #e7c3c3 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff2dede', endColorstr='#ffe7c3c3', GradientType=0);
background-repeat: repeat-x;
border-color: #dca7a7;
}
.progress {
background-image: -webkit-linear-gradient(top, #ebebeb 0%, #f5f5f5 100%);
background-image: -o-linear-gradient(top, #ebebeb 0%, #f5f5f5 100%);
background-image: -webkit-gradient(linear, left top, left bottom, from(#ebebeb), to(#f5f5f5));
background-image: linear-gradient(to bottom, #ebebeb 0%, #f5f5f5 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffebebeb', endColorstr='#fff5f5f5', GradientType=0);
background-repeat: repeat-x;
}
.progress-bar {
background-image: -webkit-linear-gradient(top, #337ab7 0%, #286090 100%);
background-image: -o-linear-gradient(top, #337ab7 0%, #286090 100%);
background-image: -webkit-gradient(linear, left top, left bottom, from(#337ab7), to(#286090));
background-image: linear-gradient(to bottom, #337ab7 0%, #286090 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff337ab7', endColorstr='#ff286090', GradientType=0);
background-repeat: repeat-x;
}
.progress-bar-success {
background-image: -webkit-linear-gradient(top, #5cb85c 0%, #449d44 100%);
background-image: -o-linear-gradient(top, #5cb85c 0%, #449d44 100%);
background-image: -webkit-gradient(linear, left top, left bottom, from(#5cb85c), to(#449d44));
background-image: linear-gradient(to bottom, #5cb85c 0%, #449d44 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff5cb85c', endColorstr='#ff449d44', GradientType=0);
background-repeat: repeat-x;
}
.progress-bar-info {
background-image: -webkit-linear-gradient(top, #5bc0de 0%, #31b0d5 100%);
background-image: -o-linear-gradient(top, #5bc0de 0%, #31b0d5 100%);
background-image: -webkit-gradient(linear, left top, left bottom, from(#5bc0de), to(#31b0d5));
background-image: linear-gradient(to bottom, #5bc0de 0%, #31b0d5 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff5bc0de', endColorstr='#ff31b0d5', GradientType=0);
background-repeat: repeat-x;
}
.progress-bar-warning {
background-image: -webkit-linear-gradient(top, #f0ad4e 0%, #ec971f 100%);
background-image: -o-linear-gradient(top, #f0ad4e 0%, #ec971f 100%);
background-image: -webkit-gradient(linear, left top, left bottom, from(#f0ad4e), to(#ec971f));
background-image: linear-gradient(to bottom, #f0ad4e 0%, #ec971f 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff0ad4e', endColorstr='#ffec971f', GradientType=0);
background-repeat: repeat-x;
}
.progress-bar-danger {
background-image: -webkit-linear-gradient(top, #d9534f 0%, #c9302c 100%);
background-image: -o-linear-gradient(top, #d9534f 0%, #c9302c 100%);
background-image: -webkit-gradient(linear, left top, left bottom, from(#d9534f), to(#c9302c));
background-image: linear-gradient(to bottom, #d9534f 0%, #c9302c 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffd9534f', endColorstr='#ffc9302c', GradientType=0);
background-repeat: repeat-x;
}
.progress-bar-striped {
background-image: -webkit-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
background-image: -o-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
background-image: linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
}
.list-group {
border-radius: 4px;
-webkit-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.075);
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.075);
}
.list-group-item.active,
.list-group-item.active:hover,
.list-group-item.active:focus {
text-shadow: 0 -1px 0 #286090;
background-image: -webkit-linear-gradient(top, #337ab7 0%, #2b669a 100%);
background-image: -o-linear-gradient(top, #337ab7 0%, #2b669a 100%);
background-image: -webkit-gradient(linear, left top, left bottom, from(#337ab7), to(#2b669a));
background-image: linear-gradient(to bottom, #337ab7 0%, #2b669a 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff337ab7', endColorstr='#ff2b669a', GradientType=0);
background-repeat: repeat-x;
border-color: #2b669a;
}
.list-group-item.active .badge,
.list-group-item.active:hover .badge,
.list-group-item.active:focus .badge {
text-shadow: none;
}
.panel {
-webkit-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}
.panel-default > .panel-heading {
background-image: -webkit-linear-gradient(top, #f5f5f5 0%, #e8e8e8 100%);
background-image: -o-linear-gradient(top, #f5f5f5 0%, #e8e8e8 100%);
background-image: -webkit-gradient(linear, left top, left bottom, from(#f5f5f5), to(#e8e8e8));
background-image: linear-gradient(to bottom, #f5f5f5 0%, #e8e8e8 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff5f5f5', endColorstr='#ffe8e8e8', GradientType=0);
background-repeat: repeat-x;
}
.panel-primary > .panel-heading {
background-image: -webkit-linear-gradient(top, #337ab7 0%, #2e6da4 100%);
background-image: -o-linear-gradient(top, #337ab7 0%, #2e6da4 100%);
background-image: -webkit-gradient(linear, left top, left bottom, from(#337ab7), to(#2e6da4));
background-image: linear-gradient(to bottom, #337ab7 0%, #2e6da4 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff337ab7', endColorstr='#ff2e6da4', GradientType=0);
background-repeat: repeat-x;
}
.panel-success > .panel-heading {
background-image: -webkit-linear-gradient(top, #dff0d8 0%, #d0e9c6 100%);
background-image: -o-linear-gradient(top, #dff0d8 0%, #d0e9c6 100%);
background-image: -webkit-gradient(linear, left top, left bottom, from(#dff0d8), to(#d0e9c6));
background-image: linear-gradient(to bottom, #dff0d8 0%, #d0e9c6 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffdff0d8', endColorstr='#ffd0e9c6', GradientType=0);
background-repeat: repeat-x;
}
.panel-info > .panel-heading {
background-image: -webkit-linear-gradient(top, #d9edf7 0%, #c4e3f3 100%);
background-image: -o-linear-gradient(top, #d9edf7 0%, #c4e3f3 100%);
background-image: -webkit-gradient(linear, left top, left bottom, from(#d9edf7), to(#c4e3f3));
background-image: linear-gradient(to bottom, #d9edf7 0%, #c4e3f3 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffd9edf7', endColorstr='#ffc4e3f3', GradientType=0);
background-repeat: repeat-x;
}
.panel-warning > .panel-heading {
background-image: -webkit-linear-gradient(top, #fcf8e3 0%, #faf2cc 100%);
background-image: -o-linear-gradient(top, #fcf8e3 0%, #faf2cc 100%);
background-image: -webkit-gradient(linear, left top, left bottom, from(#fcf8e3), to(#faf2cc));
background-image: linear-gradient(to bottom, #fcf8e3 0%, #faf2cc 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fffcf8e3', endColorstr='#fffaf2cc', GradientType=0);
background-repeat: repeat-x;
}
.panel-danger > .panel-heading {
background-image: -webkit-linear-gradient(top, #f2dede 0%, #ebcccc 100%);
background-image: -o-linear-gradient(top, #f2dede 0%, #ebcccc 100%);
background-image: -webkit-gradient(linear, left top, left bottom, from(#f2dede), to(#ebcccc));
background-image: linear-gradient(to bottom, #f2dede 0%, #ebcccc 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff2dede', endColorstr='#ffebcccc', GradientType=0);
background-repeat: repeat-x;
}
.well {
background-image: -webkit-linear-gradient(top, #e8e8e8 0%, #f5f5f5 100%);
background-image: -o-linear-gradient(top, #e8e8e8 0%, #f5f5f5 100%);
background-image: -webkit-gradient(linear, left top, left bottom, from(#e8e8e8), to(#f5f5f5));
background-image: linear-gradient(to bottom, #e8e8e8 0%, #f5f5f5 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffe8e8e8', endColorstr='#fff5f5f5', GradientType=0);
background-repeat: repeat-x;
border-color: #dcdcdc;
-webkit-box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.05), 0 1px 0 rgba(255, 255, 255, 0.1);
box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.05), 0 1px 0 rgba(255, 255, 255, 0.1);
}
/*# sourceMappingURL=bootstrap-theme.css.map */
================================================
FILE: pyscada/hmi/static/pyscada/css/bootstrap/bootstrap.css
================================================
/*!
* Bootstrap v3.4.1 (https://getbootstrap.com/)
* Copyright 2011-2019 Twitter, Inc.
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
*/
/*! normalize.css v3.0.3 | MIT License | github.com/necolas/normalize.css */
html {
font-family: sans-serif;
-ms-text-size-adjust: 100%;
-webkit-text-size-adjust: 100%;
}
body {
margin: 0;
}
article,
aside,
details,
figcaption,
figure,
footer,
header,
hgroup,
main,
menu,
nav,
section,
summary {
display: block;
}
audio,
canvas,
progress,
video {
display: inline-block;
vertical-align: baseline;
}
audio:not([controls]) {
display: none;
height: 0;
}
[hidden],
template {
display: none;
}
a {
background-color: transparent;
}
a:active,
a:hover {
outline: 0;
}
abbr[title] {
border-bottom: none;
text-decoration: underline;
-webkit-text-decoration: underline dotted;
-moz-text-decoration: underline dotted;
text-decoration: underline dotted;
}
b,
strong {
font-weight: bold;
}
dfn {
font-style: italic;
}
h1 {
font-size: 2em;
margin: 0.67em 0;
}
mark {
background: #ff0;
color: #000;
}
small {
font-size: 80%;
}
sub,
sup {
font-size: 75%;
line-height: 0;
position: relative;
vertical-align: baseline;
}
sup {
top: -0.5em;
}
sub {
bottom: -0.25em;
}
img {
border: 0;
}
svg:not(:root) {
overflow: hidden;
}
figure {
margin: 1em 40px;
}
hr {
-webkit-box-sizing: content-box;
-moz-box-sizing: content-box;
box-sizing: content-box;
height: 0;
}
pre {
overflow: auto;
}
code,
kbd,
pre,
samp {
font-family: monospace, monospace;
font-size: 1em;
}
button,
input,
optgroup,
select,
textarea {
color: inherit;
font: inherit;
margin: 0;
}
button {
overflow: visible;
}
button,
select {
text-transform: none;
}
button,
html input[type="button"],
input[type="reset"],
input[type="submit"] {
-webkit-appearance: button;
cursor: pointer;
}
button[disabled],
html input[disabled] {
cursor: default;
}
button::-moz-focus-inner,
input::-moz-focus-inner {
border: 0;
padding: 0;
}
input {
line-height: normal;
}
input[type="checkbox"],
input[type="radio"] {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
padding: 0;
}
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
height: auto;
}
input[type="search"] {
-webkit-appearance: textfield;
-webkit-box-sizing: content-box;
-moz-box-sizing: content-box;
box-sizing: content-box;
}
input[type="search"]::-webkit-search-cancel-button,
input[type="search"]::-webkit-search-decoration {
-webkit-appearance: none;
}
fieldset {
border: 1px solid #c0c0c0;
margin: 0 2px;
padding: 0.35em 0.625em 0.75em;
}
legend {
border: 0;
padding: 0;
}
textarea {
overflow: auto;
}
optgroup {
font-weight: bold;
}
table {
border-collapse: collapse;
border-spacing: 0;
}
td,
th {
padding: 0;
}
/*! Source: https://github.com/h5bp/html5-boilerplate/blob/master/src/css/main.css */
@media print {
*,
*:before,
*:after {
color: #000 !important;
text-shadow: none !important;
background: transparent !important;
-webkit-box-shadow: none !important;
box-shadow: none !important;
}
a,
a:visited {
text-decoration: underline;
}
a[href]:after {
content: " (" attr(href) ")";
}
abbr[title]:after {
content: " (" attr(title) ")";
}
a[href^="#"]:after,
a[href^="javascript:"]:after {
content: "";
}
pre,
blockquote {
border: 1px solid #999;
page-break-inside: avoid;
}
thead {
display: table-header-group;
}
tr,
img {
page-break-inside: avoid;
}
img {
max-width: 100% !important;
}
p,
h2,
h3 {
orphans: 3;
widows: 3;
}
h2,
h3 {
page-break-after: avoid;
}
.navbar {
display: none;
}
.btn > .caret,
.dropup > .btn > .caret {
border-top-color: #000 !important;
}
.label {
border: 1px solid #000;
}
.table {
border-collapse: collapse !important;
}
.table td,
.table th {
background-color: #fff !important;
}
.table-bordered th,
.table-bordered td {
border: 1px solid #ddd !important;
}
}
@font-face {
font-family: "Glyphicons Halflings";
src: url("../fonts/glyphicons-halflings-regular.eot");
src: url("../fonts/glyphicons-halflings-regular.eot?#iefix") format("embedded-opentype"), url("../fonts/glyphicons-halflings-regular.woff2") format("woff2"), url("../fonts/glyphicons-halflings-regular.woff") format("woff"), url("../fonts/glyphicons-halflings-regular.ttf") format("truetype"), url("../fonts/glyphicons-halflings-regular.svg#glyphicons_halflingsregular") format("svg");
}
.glyphicon {
position: relative;
top: 1px;
display: inline-block;
font-family: "Glyphicons Halflings";
font-style: normal;
font-weight: 400;
line-height: 1;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
.glyphicon-asterisk:before {
content: "\002a";
}
.glyphicon-plus:before {
content: "\002b";
}
.glyphicon-euro:before,
.glyphicon-eur:before {
content: "\20ac";
}
.glyphicon-minus:before {
content: "\2212";
}
.glyphicon-cloud:before {
content: "\2601";
}
.glyphicon-envelope:before {
content: "\2709";
}
.glyphicon-pencil:before {
content: "\270f";
}
.glyphicon-glass:before {
content: "\e001";
}
.glyphicon-music:before {
content: "\e002";
}
.glyphicon-search:before {
content: "\e003";
}
.glyphicon-heart:before {
content: "\e005";
}
.glyphicon-star:before {
content: "\e006";
}
.glyphicon-star-empty:before {
content: "\e007";
}
.glyphicon-user:before {
content: "\e008";
}
.glyphicon-film:before {
content: "\e009";
}
.glyphicon-th-large:before {
content: "\e010";
}
.glyphicon-th:before {
content: "\e011";
}
.glyphicon-th-list:before {
content: "\e012";
}
.glyphicon-ok:before {
content: "\e013";
}
.glyphicon-remove:before {
content: "\e014";
}
.glyphicon-zoom-in:before {
content: "\e015";
}
.glyphicon-zoom-out:before {
content: "\e016";
}
.glyphicon-off:before {
content: "\e017";
}
.glyphicon-signal:before {
content: "\e018";
}
.glyphicon-cog:before {
content: "\e019";
}
.glyphicon-trash:before {
content: "\e020";
}
.glyphicon-home:before {
content: "\e021";
}
.glyphicon-file:before {
content: "\e022";
}
.glyphicon-time:before {
content: "\e023";
}
.glyphicon-road:before {
content: "\e024";
}
.glyphicon-download-alt:before {
content: "\e025";
}
.glyphicon-download:before {
content: "\e026";
}
.glyphicon-upload:before {
content: "\e027";
}
.glyphicon-inbox:before {
content: "\e028";
}
.glyphicon-play-circle:before {
content: "\e029";
}
.glyphicon-repeat:before {
content: "\e030";
}
.glyphicon-refresh:before {
content: "\e031";
}
.glyphicon-list-alt:before {
content: "\e032";
}
.glyphicon-lock:before {
content: "\e033";
}
.glyphicon-flag:before {
content: "\e034";
}
.glyphicon-headphones:before {
content: "\e035";
}
.glyphicon-volume-off:before {
content: "\e036";
}
.glyphicon-volume-down:before {
content: "\e037";
}
.glyphicon-volume-up:before {
content: "\e038";
}
.glyphicon-qrcode:before {
content: "\e039";
}
.glyphicon-barcode:before {
content: "\e040";
}
.glyphicon-tag:before {
content: "\e041";
}
.glyphicon-tags:before {
content: "\e042";
}
.glyphicon-book:before {
content: "\e043";
}
.glyphicon-bookmark:before {
content: "\e044";
}
.glyphicon-print:before {
content: "\e045";
}
.glyphicon-camera:before {
content: "\e046";
}
.glyphicon-font:before {
content: "\e047";
}
.glyphicon-bold:before {
content: "\e048";
}
.glyphicon-italic:before {
content: "\e049";
}
.glyphicon-text-height:before {
content: "\e050";
}
.glyphicon-text-width:before {
content: "\e051";
}
.glyphicon-align-left:before {
content: "\e052";
}
.glyphicon-align-center:before {
content: "\e053";
}
.glyphicon-align-right:before {
content: "\e054";
}
.glyphicon-align-justify:before {
content: "\e055";
}
.glyphicon-list:before {
content: "\e056";
}
.glyphicon-indent-left:before {
content: "\e057";
}
.glyphicon-indent-right:before {
content: "\e058";
}
.glyphicon-facetime-video:before {
content: "\e059";
}
.glyphicon-picture:before {
content: "\e060";
}
.glyphicon-map-marker:before {
content: "\e062";
}
.glyphicon-adjust:before {
content: "\e063";
}
.glyphicon-tint:before {
content: "\e064";
}
.glyphicon-edit:before {
content: "\e065";
}
.glyphicon-share:before {
content: "\e066";
}
.glyphicon-check:before {
content: "\e067";
}
.glyphicon-move:before {
content: "\e068";
}
.glyphicon-step-backward:before {
content: "\e069";
}
.glyphicon-fast-backward:before {
content: "\e070";
}
.glyphicon-backward:before {
content: "\e071";
}
.glyphicon-play:before {
content: "\e072";
}
.glyphicon-pause:before {
content: "\e073";
}
.glyphicon-stop:before {
content: "\e074";
}
.glyphicon-forward:before {
content: "\e075";
}
.glyphicon-fast-forward:before {
content: "\e076";
}
.glyphicon-step-forward:before {
content: "\e077";
}
.glyphicon-eject:before {
content: "\e078";
}
.glyphicon-chevron-left:before {
content: "\e079";
}
.glyphicon-chevron-right:before {
content: "\e080";
}
.glyphicon-plus-sign:before {
content: "\e081";
}
.glyphicon-minus-sign:before {
content: "\e082";
}
.glyphicon-remove-sign:before {
content: "\e083";
}
.glyphicon-ok-sign:before {
content: "\e084";
}
.glyphicon-question-sign:before {
content: "\e085";
}
.glyphicon-info-sign:before {
content: "\e086";
}
.glyphicon-screenshot:before {
content: "\e087";
}
.glyphicon-remove-circle:before {
content: "\e088";
}
.glyphicon-ok-circle:before {
content: "\e089";
}
.glyphicon-ban-circle:before {
content: "\e090";
}
.glyphicon-arrow-left:before {
content: "\e091";
}
.glyphicon-arrow-right:before {
content: "\e092";
}
.glyphicon-arrow-up:before {
content: "\e093";
}
.glyphicon-arrow-down:before {
content: "\e094";
}
.glyphicon-share-alt:before {
content: "\e095";
}
.glyphicon-resize-full:before {
content: "\e096";
}
.glyphicon-resize-small:before {
content: "\e097";
}
.glyphicon-exclamation-sign:before {
content: "\e101";
}
.glyphicon-gift:before {
content: "\e102";
}
.glyphicon-leaf:before {
content: "\e103";
}
.glyphicon-fire:before {
content: "\e104";
}
.glyphicon-eye-open:before {
content: "\e105";
}
.glyphicon-eye-close:before {
content: "\e106";
}
.glyphicon-warning-sign:before {
content: "\e107";
}
.glyphicon-plane:before {
content: "\e108";
}
.glyphicon-calendar:before {
content: "\e109";
}
.glyphicon-random:before {
content: "\e110";
}
.glyphicon-comment:before {
content: "\e111";
}
.glyphicon-magnet:before {
content: "\e112";
}
.glyphicon-chevron-up:before {
content: "\e113";
}
.glyphicon-chevron-down:before {
content: "\e114";
}
.glyphicon-retweet:before {
content: "\e115";
}
.glyphicon-shopping-cart:before {
content: "\e116";
}
.glyphicon-folder-close:before {
content: "\e117";
}
.glyphicon-folder-open:before {
content: "\e118";
}
.glyphicon-resize-vertical:before {
content: "\e119";
}
.glyphicon-resize-horizontal:before {
content: "\e120";
}
.glyphicon-hdd:before {
content: "\e121";
}
.glyphicon-bullhorn:before {
content: "\e122";
}
.glyphicon-bell:before {
content: "\e123";
}
.glyphicon-certificate:before {
content: "\e124";
}
.glyphicon-thumbs-up:before {
content: "\e125";
}
.glyphicon-thumbs-down:before {
content: "\e126";
}
.glyphicon-hand-right:before {
content: "\e127";
}
.glyphicon-hand-left:before {
content: "\e128";
}
.glyphicon-hand-up:before {
content: "\e129";
}
.glyphicon-hand-down:before {
content: "\e130";
}
.glyphicon-circle-arrow-right:before {
content: "\e131";
}
.glyphicon-circle-arrow-left:before {
content: "\e132";
}
.glyphicon-circle-arrow-up:before {
content: "\e133";
}
.glyphicon-circle-arrow-down:before {
content: "\e134";
}
.glyphicon-globe:before {
content: "\e135";
}
.glyphicon-wrench:before {
content: "\e136";
}
.glyphicon-tasks:before {
content: "\e137";
}
.glyphicon-filter:before {
content: "\e138";
}
.glyphicon-briefcase:before {
content: "\e139";
}
.glyphicon-fullscreen:before {
content: "\e140";
}
.glyphicon-dashboard:before {
content: "\e141";
}
.glyphicon-paperclip:before {
content: "\e142";
}
.glyphicon-heart-empty:before {
content: "\e143";
}
.glyphicon-link:before {
content: "\e144";
}
.glyphicon-phone:before {
content: "\e145";
}
.glyphicon-pushpin:before {
content: "\e146";
}
.glyphicon-usd:before {
content: "\e148";
}
.glyphicon-gbp:before {
content: "\e149";
}
.glyphicon-sort:before {
content: "\e150";
}
.glyphicon-sort-by-alphabet:before {
content: "\e151";
}
.glyphicon-sort-by-alphabet-alt:before {
content: "\e152";
}
.glyphicon-sort-by-order:before {
content: "\e153";
}
.glyphicon-sort-by-order-alt:before {
content: "\e154";
}
.glyphicon-sort-by-attributes:before {
content: "\e155";
}
.glyphicon-sort-by-attributes-alt:before {
content: "\e156";
}
.glyphicon-unchecked:before {
content: "\e157";
}
.glyphicon-expand:before {
content: "\e158";
}
.glyphicon-collapse-down:before {
content: "\e159";
}
.glyphicon-collapse-up:before {
content: "\e160";
}
.glyphicon-log-in:before {
content: "\e161";
}
.glyphicon-flash:before {
content: "\e162";
}
.glyphicon-log-out:before {
content: "\e163";
}
.glyphicon-new-window:before {
content: "\e164";
}
.glyphicon-record:before {
content: "\e165";
}
.glyphicon-save:before {
content: "\e166";
}
.glyphicon-open:before {
content: "\e167";
}
.glyphicon-saved:before {
content: "\e168";
}
.glyphicon-import:before {
content: "\e169";
}
.glyphicon-export:before {
content: "\e170";
}
.glyphicon-send:before {
content: "\e171";
}
.glyphicon-floppy-disk:before {
content: "\e172";
}
.glyphicon-floppy-saved:before {
content: "\e173";
}
.glyphicon-floppy-remove:before {
content: "\e174";
}
.glyphicon-floppy-save:before {
content: "\e175";
}
.glyphicon-floppy-open:before {
content: "\e176";
}
.glyphicon-credit-card:before {
content: "\e177";
}
.glyphicon-transfer:before {
content: "\e178";
}
.glyphicon-cutlery:before {
content: "\e179";
}
.glyphicon-header:before {
content: "\e180";
}
.glyphicon-compressed:before {
content: "\e181";
}
.glyphicon-earphone:before {
content: "\e182";
}
.glyphicon-phone-alt:before {
content: "\e183";
}
.glyphicon-tower:before {
content: "\e184";
}
.glyphicon-stats:before {
content: "\e185";
}
.glyphicon-sd-video:before {
content: "\e186";
}
.glyphicon-hd-video:before {
content: "\e187";
}
.glyphicon-subtitles:before {
content: "\e188";
}
.glyphicon-sound-stereo:before {
content: "\e189";
}
.glyphicon-sound-dolby:before {
content: "\e190";
}
.glyphicon-sound-5-1:before {
content: "\e191";
}
.glyphicon-sound-6-1:before {
content: "\e192";
}
.glyphicon-sound-7-1:before {
content: "\e193";
}
.glyphicon-copyright-mark:before {
content: "\e194";
}
.glyphicon-registration-mark:before {
content: "\e195";
}
.glyphicon-cloud-download:before {
content: "\e197";
}
.glyphicon-cloud-upload:before {
content: "\e198";
}
.glyphicon-tree-conifer:before {
content: "\e199";
}
.glyphicon-tree-deciduous:before {
content: "\e200";
}
.glyphicon-cd:before {
content: "\e201";
}
.glyphicon-save-file:before {
content: "\e202";
}
.glyphicon-open-file:before {
content: "\e203";
}
.glyphicon-level-up:before {
content: "\e204";
}
.glyphicon-copy:before {
content: "\e205";
}
.glyphicon-paste:before {
content: "\e206";
}
.glyphicon-alert:before {
content: "\e209";
}
.glyphicon-equalizer:before {
content: "\e210";
}
.glyphicon-king:before {
content: "\e211";
}
.glyphicon-queen:before {
content: "\e212";
}
.glyphicon-pawn:before {
content: "\e213";
}
.glyphicon-bishop:before {
content: "\e214";
}
.glyphicon-knight:before {
content: "\e215";
}
.glyphicon-baby-formula:before {
content: "\e216";
}
.glyphicon-tent:before {
content: "\26fa";
}
.glyphicon-blackboard:before {
content: "\e218";
}
.glyphicon-bed:before {
content: "\e219";
}
.glyphicon-apple:before {
content: "\f8ff";
}
.glyphicon-erase:before {
content: "\e221";
}
.glyphicon-hourglass:before {
content: "\231b";
}
.glyphicon-lamp:before {
content: "\e223";
}
.glyphicon-duplicate:before {
content: "\e224";
}
.glyphicon-piggy-bank:before {
content: "\e225";
}
.glyphicon-scissors:before {
content: "\e226";
}
.glyphicon-bitcoin:before {
content: "\e227";
}
.glyphicon-btc:before {
content: "\e227";
}
.glyphicon-xbt:before {
content: "\e227";
}
.glyphicon-yen:before {
content: "\00a5";
}
.glyphicon-jpy:before {
content: "\00a5";
}
.glyphicon-ruble:before {
content: "\20bd";
}
.glyphicon-rub:before {
content: "\20bd";
}
.glyphicon-scale:before {
content: "\e230";
}
.glyphicon-ice-lolly:before {
content: "\e231";
}
.glyphicon-ice-lolly-tasted:before {
content: "\e232";
}
.glyphicon-education:before {
content: "\e233";
}
.glyphicon-option-horizontal:before {
content: "\e234";
}
.glyphicon-option-vertical:before {
content: "\e235";
}
.glyphicon-menu-hamburger:before {
content: "\e236";
}
.glyphicon-modal-window:before {
content: "\e237";
}
.glyphicon-oil:before {
content: "\e238";
}
.glyphicon-grain:before {
content: "\e239";
}
.glyphicon-sunglasses:before {
content: "\e240";
}
.glyphicon-text-size:before {
content: "\e241";
}
.glyphicon-text-color:before {
content: "\e242";
}
.glyphicon-text-background:before {
content: "\e243";
}
.glyphicon-object-align-top:before {
content: "\e244";
}
.glyphicon-object-align-bottom:before {
content: "\e245";
}
.glyphicon-object-align-horizontal:before {
content: "\e246";
}
.glyphicon-object-align-left:before {
content: "\e247";
}
.glyphicon-object-align-vertical:before {
content: "\e248";
}
.glyphicon-object-align-right:before {
content: "\e249";
}
.glyphicon-triangle-right:before {
content: "\e250";
}
.glyphicon-triangle-left:before {
content: "\e251";
}
.glyphicon-triangle-bottom:before {
content: "\e252";
}
.glyphicon-triangle-top:before {
content: "\e253";
}
.glyphicon-console:before {
content: "\e254";
}
.glyphicon-superscript:before {
content: "\e255";
}
.glyphicon-subscript:before {
content: "\e256";
}
.glyphicon-menu-left:before {
content: "\e257";
}
.glyphicon-menu-right:before {
content: "\e258";
}
.glyphicon-menu-down:before {
content: "\e259";
}
.glyphicon-menu-up:before {
content: "\e260";
}
* {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
*:before,
*:after {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
html {
font-size: 10px;
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
}
body {
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
font-size: 14px;
line-height: 1.42857143;
color: #333333;
background-color: #fff;
}
input,
button,
select,
textarea {
font-family: inherit;
font-size: inherit;
line-height: inherit;
}
a {
color: #337ab7;
text-decoration: none;
}
a:hover,
a:focus {
color: #23527c;
text-decoration: underline;
}
a:focus {
outline: 5px auto -webkit-focus-ring-color;
outline-offset: -2px;
}
figure {
margin: 0;
}
img {
vertical-align: middle;
}
.img-responsive,
.thumbnail > img,
.thumbnail a > img,
.carousel-inner > .item > img,
.carousel-inner > .item > a > img {
display: block;
max-width: 100%;
height: auto;
}
.img-rounded {
border-radius: 6px;
}
.img-thumbnail {
padding: 4px;
line-height: 1.42857143;
background-color: #fff;
border: 1px solid #ddd;
border-radius: 4px;
-webkit-transition: all 0.2s ease-in-out;
-o-transition: all 0.2s ease-in-out;
transition: all 0.2s ease-in-out;
display: inline-block;
max-width: 100%;
height: auto;
}
.img-circle {
border-radius: 50%;
}
hr {
margin-top: 20px;
margin-bottom: 20px;
border: 0;
border-top: 1px solid #eeeeee;
}
.sr-only {
position: absolute;
width: 1px;
height: 1px;
padding: 0;
margin: -1px;
overflow: hidden;
clip: rect(0, 0, 0, 0);
border: 0;
}
.sr-only-focusable:active,
.sr-only-focusable:focus {
position: static;
width: auto;
height: auto;
margin: 0;
overflow: visible;
clip: auto;
}
[role="button"] {
cursor: pointer;
}
h1,
h2,
h3,
h4,
h5,
h6,
.h1,
.h2,
.h3,
.h4,
.h5,
.h6 {
font-family: inherit;
font-weight: 500;
line-height: 1.1;
color: inherit;
}
h1 small,
h2 small,
h3 small,
h4 small,
h5 small,
h6 small,
.h1 small,
.h2 small,
.h3 small,
.h4 small,
.h5 small,
.h6 small,
h1 .small,
h2 .small,
h3 .small,
h4 .small,
h5 .small,
h6 .small,
.h1 .small,
.h2 .small,
.h3 .small,
.h4 .small,
.h5 .small,
.h6 .small {
font-weight: 400;
line-height: 1;
color: #777777;
}
h1,
.h1,
h2,
.h2,
h3,
.h3 {
margin-top: 20px;
margin-bottom: 10px;
}
h1 small,
.h1 small,
h2 small,
.h2 small,
h3 small,
.h3 small,
h1 .small,
.h1 .small,
h2 .small,
.h2 .small,
h3 .small,
.h3 .small {
font-size: 65%;
}
h4,
.h4,
h5,
.h5,
h6,
.h6 {
margin-top: 10px;
margin-bottom: 10px;
}
h4 small,
.h4 small,
h5 small,
.h5 small,
h6 small,
.h6 small,
h4 .small,
.h4 .small,
h5 .small,
.h5 .small,
h6 .small,
.h6 .small {
font-size: 75%;
}
h1,
.h1 {
font-size: 36px;
}
h2,
.h2 {
font-size: 30px;
}
h3,
.h3 {
font-size: 24px;
}
h4,
.h4 {
font-size: 18px;
}
h5,
.h5 {
font-size: 14px;
}
h6,
.h6 {
font-size: 12px;
}
p {
margin: 0 0 10px;
}
.lead {
margin-bottom: 20px;
font-size: 16px;
font-weight: 300;
line-height: 1.4;
}
@media (min-width: 768px) {
.lead {
font-size: 21px;
}
}
small,
.small {
font-size: 85%;
}
mark,
.mark {
padding: 0.2em;
background-color: #fcf8e3;
}
.text-left {
text-align: left;
}
.text-right {
text-align: right;
}
.text-center {
text-align: center;
}
.text-justify {
text-align: justify;
}
.text-nowrap {
white-space: nowrap;
}
.text-lowercase {
text-transform: lowercase;
}
.text-uppercase {
text-transform: uppercase;
}
.text-capitalize {
text-transform: capitalize;
}
.text-muted {
color: #777777;
}
.text-primary {
color: #337ab7;
}
a.text-primary:hover,
a.text-primary:focus {
color: #286090;
}
.text-success {
color: #3c763d;
}
a.text-success:hover,
a.text-success:focus {
color: #2b542c;
}
.text-info {
color: #31708f;
}
a.text-info:hover,
a.text-info:focus {
color: #245269;
}
.text-warning {
color: #8a6d3b;
}
a.text-warning:hover,
a.text-warning:focus {
color: #66512c;
}
.text-danger {
color: #a94442;
}
a.text-danger:hover,
a.text-danger:focus {
color: #843534;
}
.bg-primary {
color: #fff;
background-color: #337ab7;
}
a.bg-primary:hover,
a.bg-primary:focus {
background-color: #286090;
}
.bg-success {
background-color: #dff0d8;
}
a.bg-success:hover,
a.bg-success:focus {
background-color: #c1e2b3;
}
.bg-info {
background-color: #d9edf7;
}
a.bg-info:hover,
a.bg-info:focus {
background-color: #afd9ee;
}
.bg-warning {
background-color: #fcf8e3;
}
a.bg-warning:hover,
a.bg-warning:focus {
background-color: #f7ecb5;
}
.bg-danger {
background-color: #f2dede;
}
a.bg-danger:hover,
a.bg-danger:focus {
background-color: #e4b9b9;
}
.page-header {
padding-bottom: 9px;
margin: 40px 0 20px;
border-bottom: 1px solid #eeeeee;
}
ul,
ol {
margin-top: 0;
margin-bottom: 10px;
}
ul ul,
ol ul,
ul ol,
ol ol {
margin-bottom: 0;
}
.list-unstyled {
padding-left: 0;
list-style: none;
}
.list-inline {
padding-left: 0;
list-style: none;
margin-left: -5px;
}
.list-inline > li {
display: inline-block;
padding-right: 5px;
padding-left: 5px;
}
dl {
margin-top: 0;
margin-bottom: 20px;
}
dt,
dd {
line-height: 1.42857143;
}
dt {
font-weight: 700;
}
dd {
margin-left: 0;
}
@media (min-width: 768px) {
.dl-horizontal dt {
float: left;
width: 160px;
clear: left;
text-align: right;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.dl-horizontal dd {
margin-left: 180px;
}
}
abbr[title],
abbr[data-original-title] {
cursor: help;
}
.initialism {
font-size: 90%;
text-transform: uppercase;
}
blockquote {
padding: 10px 20px;
margin: 0 0 20px;
font-size: 17.5px;
border-left: 5px solid #eeeeee;
}
blockquote p:last-child,
blockquote ul:last-child,
blockquote ol:last-child {
margin-bottom: 0;
}
blockquote footer,
blockquote small,
blockquote .small {
display: block;
font-size: 80%;
line-height: 1.42857143;
color: #777777;
}
blockquote footer:before,
blockquote small:before,
blockquote .small:before {
content: "\2014 \00A0";
}
.blockquote-reverse,
blockquote.pull-right {
padding-right: 15px;
padding-left: 0;
text-align: right;
border-right: 5px solid #eeeeee;
border-left: 0;
}
.blockquote-reverse footer:before,
blockquote.pull-right footer:before,
.blockquote-reverse small:before,
blockquote.pull-right small:before,
.blockquote-reverse .small:before,
blockquote.pull-right .small:before {
content: "";
}
.blockquote-reverse footer:after,
blockquote.pull-right footer:after,
.blockquote-reverse small:after,
blockquote.pull-right small:after,
.blockquote-reverse .small:after,
blockquote.pull-right .small:after {
content: "\00A0 \2014";
}
address {
margin-bottom: 20px;
font-style: normal;
line-height: 1.42857143;
}
code,
kbd,
pre,
samp {
font-family: Menlo, Monaco, Consolas, "Courier New", monospace;
}
code {
padding: 2px 4px;
font-size: 90%;
color: #c7254e;
background-color: #f9f2f4;
border-radius: 4px;
}
kbd {
padding: 2px 4px;
font-size: 90%;
color: #fff;
background-color: #333;
border-radius: 3px;
-webkit-box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.25);
box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.25);
}
kbd kbd {
padding: 0;
font-size: 100%;
font-weight: 700;
-webkit-box-shadow: none;
box-shadow: none;
}
pre {
display: block;
padding: 9.5px;
margin: 0 0 10px;
font-size: 13px;
line-height: 1.42857143;
color: #333333;
word-break: break-all;
word-wrap: break-word;
background-color: #f5f5f5;
border: 1px solid #ccc;
border-radius: 4px;
}
pre code {
padding: 0;
font-size: inherit;
color: inherit;
white-space: pre-wrap;
background-color: transparent;
border-radius: 0;
}
.pre-scrollable {
max-height: 340px;
overflow-y: scroll;
}
.container {
padding-right: 15px;
padding-left: 15px;
margin-right: auto;
margin-left: auto;
}
@media (min-width: 768px) {
.container {
width: 750px;
}
}
@media (min-width: 992px) {
.container {
width: 970px;
}
}
@media (min-width: 1200px) {
.container {
width: 1170px;
}
}
.container-fluid {
padding-right: 15px;
padding-left: 15px;
margin-right: auto;
margin-left: auto;
}
.row {
margin-right: -15px;
margin-left: -15px;
}
.row-no-gutters {
margin-right: 0;
margin-left: 0;
}
.row-no-gutters [class*="col-"] {
padding-right: 0;
padding-left: 0;
}
.col-xs-1,
.col-sm-1,
.col-md-1,
.col-lg-1,
.col-xs-2,
.col-sm-2,
.col-md-2,
.col-lg-2,
.col-xs-3,
.col-sm-3,
.col-md-3,
.col-lg-3,
.col-xs-4,
.col-sm-4,
.col-md-4,
.col-lg-4,
.col-xs-5,
.col-sm-5,
.col-md-5,
.col-lg-5,
.col-xs-6,
.col-sm-6,
.col-md-6,
.col-lg-6,
.col-xs-7,
.col-sm-7,
.col-md-7,
.col-lg-7,
.col-xs-8,
.col-sm-8,
.col-md-8,
.col-lg-8,
.col-xs-9,
.col-sm-9,
.col-md-9,
.col-lg-9,
.col-xs-10,
.col-sm-10,
.col-md-10,
.col-lg-10,
.col-xs-11,
.col-sm-11,
.col-md-11,
.col-lg-11,
.col-xs-12,
.col-sm-12,
.col-md-12,
.col-lg-12 {
position: relative;
min-height: 1px;
padding-right: 15px;
padding-left: 15px;
}
.col-xs-1,
.col-xs-2,
.col-xs-3,
.col-xs-4,
.col-xs-5,
.col-xs-6,
.col-xs-7,
.col-xs-8,
.col-xs-9,
.col-xs-10,
.col-xs-11,
.col-xs-12 {
float: left;
}
.col-xs-12 {
width: 100%;
}
.col-xs-11 {
width: 91.66666667%;
}
.col-xs-10 {
width: 83.33333333%;
}
.col-xs-9 {
width: 75%;
}
.col-xs-8 {
width: 66.66666667%;
}
.col-xs-7 {
width: 58.33333333%;
}
.col-xs-6 {
width: 50%;
}
.col-xs-5 {
width: 41.66666667%;
}
.col-xs-4 {
width: 33.33333333%;
}
.col-xs-3 {
width: 25%;
}
.col-xs-2 {
width: 16.66666667%;
}
.col-xs-1 {
width: 8.33333333%;
}
.col-xs-pull-12 {
right: 100%;
}
.col-xs-pull-11 {
right: 91.66666667%;
}
.col-xs-pull-10 {
right: 83.33333333%;
}
.col-xs-pull-9 {
right: 75%;
}
.col-xs-pull-8 {
right: 66.66666667%;
}
.col-xs-pull-7 {
right: 58.33333333%;
}
.col-xs-pull-6 {
right: 50%;
}
.col-xs-pull-5 {
right: 41.66666667%;
}
.col-xs-pull-4 {
right: 33.33333333%;
}
.col-xs-pull-3 {
right: 25%;
}
.col-xs-pull-2 {
right: 16.66666667%;
}
.col-xs-pull-1 {
right: 8.33333333%;
}
.col-xs-pull-0 {
right: auto;
}
.col-xs-push-12 {
left: 100%;
}
.col-xs-push-11 {
left: 91.66666667%;
}
.col-xs-push-10 {
left: 83.33333333%;
}
.col-xs-push-9 {
left: 75%;
}
.col-xs-push-8 {
left: 66.66666667%;
}
.col-xs-push-7 {
left: 58.33333333%;
}
.col-xs-push-6 {
left: 50%;
}
.col-xs-push-5 {
left: 41.66666667%;
}
.col-xs-push-4 {
left: 33.33333333%;
}
.col-xs-push-3 {
left: 25%;
}
.col-xs-push-2 {
left: 16.66666667%;
}
.col-xs-push-1 {
left: 8.33333333%;
}
.col-xs-push-0 {
left: auto;
}
.col-xs-offset-12 {
margin-left: 100%;
}
.col-xs-offset-11 {
margin-left: 91.66666667%;
}
.col-xs-offset-10 {
margin-left: 83.33333333%;
}
.col-xs-offset-9 {
margin-left: 75%;
}
.col-xs-offset-8 {
margin-left: 66.66666667%;
}
.col-xs-offset-7 {
margin-left: 58.33333333%;
}
.col-xs-offset-6 {
margin-left: 50%;
}
.col-xs-offset-5 {
margin-left: 41.66666667%;
}
.col-xs-offset-4 {
margin-left: 33.33333333%;
}
.col-xs-offset-3 {
margin-left: 25%;
}
.col-xs-offset-2 {
margin-left: 16.66666667%;
}
.col-xs-offset-1 {
margin-left: 8.33333333%;
}
.col-xs-offset-0 {
margin-left: 0%;
}
@media (min-width: 768px) {
.col-sm-1,
.col-sm-2,
.col-sm-3,
.col-sm-4,
.col-sm-5,
.col-sm-6,
.col-sm-7,
.col-sm-8,
.col-sm-9,
.col-sm-10,
.col-sm-11,
.col-sm-12 {
float: left;
}
.col-sm-12 {
width: 100%;
}
.col-sm-11 {
width: 91.66666667%;
}
.col-sm-10 {
width: 83.33333333%;
}
.col-sm-9 {
width: 75%;
}
.col-sm-8 {
width: 66.66666667%;
}
.col-sm-7 {
width: 58.33333333%;
}
.col-sm-6 {
width: 50%;
}
.col-sm-5 {
width: 41.66666667%;
}
.col-sm-4 {
width: 33.33333333%;
}
.col-sm-3 {
width: 25%;
}
.col-sm-2 {
width: 16.66666667%;
}
.col-sm-1 {
width: 8.33333333%;
}
.col-sm-pull-12 {
right: 100%;
}
.col-sm-pull-11 {
right: 91.66666667%;
}
.col-sm-pull-10 {
right: 83.33333333%;
}
.col-sm-pull-9 {
right: 75%;
}
.col-sm-pull-8 {
right: 66.66666667%;
}
.col-sm-pull-7 {
right: 58.33333333%;
}
.col-sm-pull-6 {
right: 50%;
}
.col-sm-pull-5 {
right: 41.66666667%;
}
.col-sm-pull-4 {
right: 33.33333333%;
}
.col-sm-pull-3 {
right: 25%;
}
.col-sm-pull-2 {
right: 16.66666667%;
}
.col-sm-pull-1 {
right: 8.33333333%;
}
.col-sm-pull-0 {
right: auto;
}
.col-sm-push-12 {
left: 100%;
}
.col-sm-push-11 {
left: 91.66666667%;
}
.col-sm-push-10 {
left: 83.33333333%;
}
.col-sm-push-9 {
left: 75%;
}
.col-sm-push-8 {
left: 66.66666667%;
}
.col-sm-push-7 {
left: 58.33333333%;
}
.col-sm-push-6 {
left: 50%;
}
.col-sm-push-5 {
left: 41.66666667%;
}
.col-sm-push-4 {
left: 33.33333333%;
}
.col-sm-push-3 {
left: 25%;
}
.col-sm-push-2 {
left: 16.66666667%;
}
.col-sm-push-1 {
left: 8.33333333%;
}
.col-sm-push-0 {
left: auto;
}
.col-sm-offset-12 {
margin-left: 100%;
}
.col-sm-offset-11 {
margin-left: 91.66666667%;
}
.col-sm-offset-10 {
margin-left: 83.33333333%;
}
.col-sm-offset-9 {
margin-left: 75%;
}
.col-sm-offset-8 {
margin-left: 66.66666667%;
}
.col-sm-offset-7 {
margin-left: 58.33333333%;
}
.col-sm-offset-6 {
margin-left: 50%;
}
.col-sm-offset-5 {
margin-left: 41.66666667%;
}
.col-sm-offset-4 {
margin-left: 33.33333333%;
}
.col-sm-offset-3 {
margin-left: 25%;
}
.col-sm-offset-2 {
margin-left: 16.66666667%;
}
.col-sm-offset-1 {
margin-left: 8.33333333%;
}
.col-sm-offset-0 {
margin-left: 0%;
}
}
@media (min-width: 992px) {
.col-md-1,
.col-md-2,
.col-md-3,
.col-md-4,
.col-md-5,
.col-md-6,
.col-md-7,
.col-md-8,
.col-md-9,
.col-md-10,
.col-md-11,
.col-md-12 {
float: left;
}
.col-md-12 {
width: 100%;
}
.col-md-11 {
width: 91.66666667%;
}
.col-md-10 {
width: 83.33333333%;
}
.col-md-9 {
width: 75%;
}
.col-md-8 {
width: 66.66666667%;
}
.col-md-7 {
width: 58.33333333%;
}
.col-md-6 {
width: 50%;
}
.col-md-5 {
width: 41.66666667%;
}
.col-md-4 {
width: 33.33333333%;
}
.col-md-3 {
width: 25%;
}
.col-md-2 {
width: 16.66666667%;
}
.col-md-1 {
width: 8.33333333%;
}
.col-md-pull-12 {
right: 100%;
}
.col-md-pull-11 {
right: 91.66666667%;
}
.col-md-pull-10 {
right: 83.33333333%;
}
.col-md-pull-9 {
right: 75%;
}
.col-md-pull-8 {
right: 66.66666667%;
}
.col-md-pull-7 {
right: 58.33333333%;
}
.col-md-pull-6 {
right: 50%;
}
.col-md-pull-5 {
right: 41.66666667%;
}
.col-md-pull-4 {
right: 33.33333333%;
}
.col-md-pull-3 {
right: 25%;
}
.col-md-pull-2 {
right: 16.66666667%;
}
.col-md-pull-1 {
right: 8.33333333%;
}
.col-md-pull-0 {
right: auto;
}
.col-md-push-12 {
left: 100%;
}
.col-md-push-11 {
left: 91.66666667%;
}
.col-md-push-10 {
left: 83.33333333%;
}
.col-md-push-9 {
left: 75%;
}
.col-md-push-8 {
left: 66.66666667%;
}
.col-md-push-7 {
left: 58.33333333%;
}
.col-md-push-6 {
left: 50%;
}
.col-md-push-5 {
left: 41.66666667%;
}
.col-md-push-4 {
left: 33.33333333%;
}
.col-md-push-3 {
left: 25%;
}
.col-md-push-2 {
left: 16.66666667%;
}
.col-md-push-1 {
left: 8.33333333%;
}
.col-md-push-0 {
left: auto;
}
.col-md-offset-12 {
margin-left: 100%;
}
.col-md-offset-11 {
margin-left: 91.66666667%;
}
.col-md-offset-10 {
margin-left: 83.33333333%;
}
.col-md-offset-9 {
margin-left: 75%;
}
.col-md-offset-8 {
margin-left: 66.66666667%;
}
.col-md-offset-7 {
margin-left: 58.33333333%;
}
.col-md-offset-6 {
margin-left: 50%;
}
.col-md-offset-5 {
margin-left: 41.66666667%;
}
.col-md-offset-4 {
margin-left: 33.33333333%;
}
.col-md-offset-3 {
margin-left: 25%;
}
.col-md-offset-2 {
margin-left: 16.66666667%;
}
.col-md-offset-1 {
margin-left: 8.33333333%;
}
.col-md-offset-0 {
margin-left: 0%;
}
}
@media (min-width: 1200px) {
.col-lg-1,
.col-lg-2,
.col-lg-3,
.col-lg-4,
.col-lg-5,
.col-lg-6,
.col-lg-7,
.col-lg-8,
.col-lg-9,
.col-lg-10,
.col-lg-11,
.col-lg-12 {
float: left;
}
.col-lg-12 {
width: 100%;
}
.col-lg-11 {
width: 91.66666667%;
}
.col-lg-10 {
width: 83.33333333%;
}
.col-lg-9 {
width: 75%;
}
.col-lg-8 {
width: 66.66666667%;
}
.col-lg-7 {
width: 58.33333333%;
}
.col-lg-6 {
width: 50%;
}
.col-lg-5 {
width: 41.66666667%;
}
.col-lg-4 {
width: 33.33333333%;
}
.col-lg-3 {
width: 25%;
}
.col-lg-2 {
width: 16.66666667%;
}
.col-lg-1 {
width: 8.33333333%;
}
.col-lg-pull-12 {
right: 100%;
}
.col-lg-pull-11 {
right: 91.66666667%;
}
.col-lg-pull-10 {
right: 83.33333333%;
}
.col-lg-pull-9 {
right: 75%;
}
.col-lg-pull-8 {
right: 66.66666667%;
}
.col-lg-pull-7 {
right: 58.33333333%;
}
.col-lg-pull-6 {
right: 50%;
}
.col-lg-pull-5 {
right: 41.66666667%;
}
.col-lg-pull-4 {
right: 33.33333333%;
}
.col-lg-pull-3 {
right: 25%;
}
.col-lg-pull-2 {
right: 16.66666667%;
}
.col-lg-pull-1 {
right: 8.33333333%;
}
.col-lg-pull-0 {
right: auto;
}
.col-lg-push-12 {
left: 100%;
}
.col-lg-push-11 {
left: 91.66666667%;
}
.col-lg-push-10 {
left: 83.33333333%;
}
.col-lg-push-9 {
left: 75%;
}
.col-lg-push-8 {
left: 66.66666667%;
}
.col-lg-push-7 {
left: 58.33333333%;
}
.col-lg-push-6 {
left: 50%;
}
.col-lg-push-5 {
left: 41.66666667%;
}
.col-lg-push-4 {
left: 33.33333333%;
}
.col-lg-push-3 {
left: 25%;
}
.col-lg-push-2 {
left: 16.66666667%;
}
.col-lg-push-1 {
left: 8.33333333%;
}
.col-lg-push-0 {
left: auto;
}
.col-lg-offset-12 {
margin-left: 100%;
}
.col-lg-offset-11 {
margin-left: 91.66666667%;
}
.col-lg-offset-10 {
margin-left: 83.33333333%;
}
.col-lg-offset-9 {
margin-left: 75%;
}
.col-lg-offset-8 {
margin-left: 66.66666667%;
}
.col-lg-offset-7 {
margin-left: 58.33333333%;
}
.col-lg-offset-6 {
margin-left: 50%;
}
.col-lg-offset-5 {
margin-left: 41.66666667%;
}
.col-lg-offset-4 {
margin-left: 33.33333333%;
}
.col-lg-offset-3 {
margin-left: 25%;
}
.col-lg-offset-2 {
margin-left: 16.66666667%;
}
.col-lg-offset-1 {
margin-left: 8.33333333%;
}
.col-lg-offset-0 {
margin-left: 0%;
}
}
table {
background-color: transparent;
}
table col[class*="col-"] {
position: static;
display: table-column;
float: none;
}
table td[class*="col-"],
table th[class*="col-"] {
position: static;
display: table-cell;
float: none;
}
caption {
padding-top: 8px;
padding-bottom: 8px;
color: #777777;
text-align: left;
}
th {
text-align: left;
}
.table {
width: 100%;
max-width: 100%;
margin-bottom: 20px;
}
.table > thead > tr > th,
.table > tbody > tr > th,
.table > tfoot > tr > th,
.table > thead > tr > td,
.table > tbody > tr > td,
.table > tfoot > tr > td {
padding: 8px;
line-height: 1.42857143;
vertical-align: top;
border-top: 1px solid #ddd;
}
.table > thead > tr > th {
vertical-align: bottom;
border-bottom: 2px solid #ddd;
}
.table > caption + thead > tr:first-child > th,
.table > colgroup + thead > tr:first-child > th,
.table > thead:first-child > tr:first-child > th,
.table > caption + thead > tr:first-child > td,
.table > colgroup + thead > tr:first-child > td,
.table > thead:first-child > tr:first-child > td {
border-top: 0;
}
.table > tbody + tbody {
border-top: 2px solid #ddd;
}
.table .table {
background-color: #fff;
}
.table-condensed > thead > tr > th,
.table-condensed > tbody > tr > th,
.table-condensed > tfoot > tr > th,
.table-condensed > thead > tr > td,
.table-condensed > tbody > tr > td,
.table-condensed > tfoot > tr > td {
padding: 5px;
}
.table-bordered {
border: 1px solid #ddd;
}
.table-bordered > thead > tr > th,
.table-bordered > tbody > tr > th,
.table-bordered > tfoot > tr > th,
.table-bordered > thead > tr > td,
.table-bordered > tbody > tr > td,
.table-bordered > tfoot > tr > td {
border: 1px solid #ddd;
}
.table-bordered > thead > tr > th,
.table-bordered > thead > tr > td {
border-bottom-width: 2px;
}
.table-striped > tbody > tr:nth-of-type(odd) {
background-color: #f9f9f9;
}
.table-hover > tbody > tr:hover {
background-color: #f5f5f5;
}
.table > thead > tr > td.active,
.table > tbody > tr > td.active,
.table > tfoot > tr > td.active,
.table > thead > tr > th.active,
.table > tbody > tr > th.active,
.table > tfoot > tr > th.active,
.table > thead > tr.active > td,
.table > tbody > tr.active > td,
.table > tfoot > tr.active > td,
.table > thead > tr.active > th,
.table > tbody > tr.active > th,
.table > tfoot > tr.active > th {
background-color: #f5f5f5;
}
.table-hover > tbody > tr > td.active:hover,
.table-hover > tbody > tr > th.active:hover,
.table-hover > tbody > tr.active:hover > td,
.table-hover > tbody > tr:hover > .active,
.table-hover > tbody > tr.active:hover > th {
background-color: #e8e8e8;
}
.table > thead > tr > td.success,
.table > tbody > tr > td.success,
.table > tfoot > tr > td.success,
.table > thead > tr > th.success,
.table > tbody > tr > th.success,
.table > tfoot > tr > th.success,
.table > thead > tr.success > td,
.table > tbody > tr.success > td,
.table > tfoot > tr.success > td,
.table > thead > tr.success > th,
.table > tbody > tr.success > th,
.table > tfoot > tr.success > th {
background-color: #dff0d8;
}
.table-hover > tbody > tr > td.success:hover,
.table-hover > tbody > tr > th.success:hover,
.table-hover > tbody > tr.success:hover > td,
.table-hover > tbody > tr:hover > .success,
.table-hover > tbody > tr.success:hover > th {
background-color: #d0e9c6;
}
.table > thead > tr > td.info,
.table > tbody > tr > td.info,
.table > tfoot > tr > td.info,
.table > thead > tr > th.info,
.table > tbody > tr > th.info,
.table > tfoot > tr > th.info,
.table > thead > tr.info > td,
.table > tbody > tr.info > td,
.table > tfoot > tr.info > td,
.table > thead > tr.info > th,
.table > tbody > tr.info > th,
.table > tfoot > tr.info > th {
background-color: #d9edf7;
}
.table-hover > tbody > tr > td.info:hover,
.table-hover > tbody > tr > th.info:hover,
.table-hover > tbody > tr.info:hover > td,
.table-hover > tbody > tr:hover > .info,
.table-hover > tbody > tr.info:hover > th {
background-color: #c4e3f3;
}
.table > thead > tr > td.warning,
.table > tbody > tr > td.warning,
.table > tfoot > tr > td.warning,
.table > thead > tr > th.warning,
.table > tbody > tr > th.warning,
.table > tfoot > tr > th.warning,
.table > thead > tr.warning > td,
.table > tbody > tr.warning > td,
.table > tfoot > tr.warning > td,
.table > thead > tr.warning > th,
.table > tbody > tr.warning > th,
.table > tfoot > tr.warning > th {
background-color: #fcf8e3;
}
.table-hover > tbody > tr > td.warning:hover,
.table-hover > tbody > tr > th.warning:hover,
.table-hover > tbody > tr.warning:hover > td,
.table-hover > tbody > tr:hover > .warning,
.table-hover > tbody > tr.warning:hover > th {
background-color: #faf2cc;
}
.table > thead > tr > td.danger,
.table > tbody > tr > td.danger,
.table > tfoot > tr > td.danger,
.table > thead > tr > th.danger,
.table > tbody > tr > th.danger,
.table > tfoot > tr > th.danger,
.table > thead > tr.danger > td,
.table > tbody > tr.danger > td,
.table > tfoot > tr.danger > td,
.table > thead > tr.danger > th,
.table > tbody > tr.danger > th,
.table > tfoot > tr.danger > th {
background-color: #f2dede;
}
.table-hover > tbody > tr > td.danger:hover,
.table-hover > tbody > tr > th.danger:hover,
.table-hover > tbody > tr.danger:hover > td,
.table-hover > tbody > tr:hover > .danger,
.table-hover > tbody > tr.danger:hover > th {
background-color: #ebcccc;
}
.table-responsive {
min-height: 0.01%;
overflow-x: auto;
}
@media screen and (max-width: 767px) {
.table-responsive {
width: 100%;
margin-bottom: 15px;
overflow-y: hidden;
-ms-overflow-style: -ms-autohiding-scrollbar;
border: 1px solid #ddd;
}
.table-responsive > .table {
margin-bottom: 0;
}
.table-responsive > .table > thead > tr > th,
.table-responsive > .table > tbody > tr > th,
.table-responsive > .table > tfoot > tr > th,
.table-responsive > .table > thead > tr > td,
.table-responsive > .table > tbody > tr > td,
.table-responsive > .table > tfoot > tr > td {
white-space: nowrap;
}
.table-responsive > .table-bordered {
border: 0;
}
.table-responsive > .table-bordered > thead > tr > th:first-child,
.table-responsive > .table-bordered > tbody > tr > th:first-child,
.table-responsive > .table-bordered > tfoot > tr > th:first-child,
.table-responsive > .table-bordered > thead > tr > td:first-child,
.table-responsive > .table-bordered > tbody > tr > td:first-child,
.table-responsive > .table-bordered > tfoot > tr > td:first-child {
border-left: 0;
}
.table-responsive > .table-bordered > thead > tr > th:last-child,
.table-responsive > .table-bordered > tbody > tr > th:last-child,
.table-responsive > .table-bordered > tfoot > tr > th:last-child,
.table-responsive > .table-bordered > thead > tr > td:last-child,
.table-responsive > .table-bordered > tbody > tr > td:last-child,
.table-responsive > .table-bordered > tfoot > tr > td:last-child {
border-right: 0;
}
.table-responsive > .table-bordered > tbody > tr:last-child > th,
.table-responsive > .table-bordered > tfoot > tr:last-child > th,
.table-responsive > .table-bordered > tbody > tr:last-child > td,
.table-responsive > .table-bordered > tfoot > tr:last-child > td {
border-bottom: 0;
}
}
fieldset {
min-width: 0;
padding: 0;
margin: 0;
border: 0;
}
legend {
display: block;
width: 100%;
padding: 0;
margin-bottom: 20px;
font-size: 21px;
line-height: inherit;
color: #333333;
border: 0;
border-bottom: 1px solid #e5e5e5;
}
label {
display: inline-block;
max-width: 100%;
margin-bottom: 5px;
font-weight: 700;
}
input[type="search"] {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
}
input[type="radio"],
input[type="checkbox"] {
margin: 4px 0 0;
margin-top: 1px \9;
line-height: normal;
}
input[type="radio"][disabled],
input[type="checkbox"][disabled],
input[type="radio"].disabled,
input[type="checkbox"].disabled,
fieldset[disabled] input[type="radio"],
fieldset[disabled] input[type="checkbox"] {
cursor: not-allowed;
}
input[type="file"] {
display: block;
}
input[type="range"] {
display: block;
width: 100%;
}
select[multiple],
select[size] {
height: auto;
}
input[type="file"]:focus,
input[type="radio"]:focus,
input[type="checkbox"]:focus {
outline: 5px auto -webkit-focus-ring-color;
outline-offset: -2px;
}
output {
display: block;
padding-top: 7px;
font-size: 14px;
line-height: 1.42857143;
color: #555555;
}
.form-control {
display: block;
width: 100%;
height: 34px;
padding: 6px 12px;
font-size: 14px;
line-height: 1.42857143;
color: #555555;
background-color: #fff;
background-image: none;
border: 1px solid #ccc;
border-radius: 4px;
-webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
-webkit-transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s;
-o-transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s;
-webkit-transition: border-color ease-in-out .15s, -webkit-box-shadow ease-in-out .15s;
transition: border-color ease-in-out .15s, -webkit-box-shadow ease-in-out .15s;
transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s;
transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s, -webkit-box-shadow ease-in-out .15s;
}
.form-control:focus {
border-color: #66afe9;
outline: 0;
-webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075), 0 0 8px rgba(102, 175, 233, 0.6);
box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075), 0 0 8px rgba(102, 175, 233, 0.6);
}
.form-control::-moz-placeholder {
color: #999;
opacity: 1;
}
.form-control:-ms-input-placeholder {
color: #999;
}
.form-control::-webkit-input-placeholder {
color: #999;
}
.form-control::-ms-expand {
background-color: transparent;
border: 0;
}
.form-control[disabled],
.form-control[readonly],
fieldset[disabled] .form-control {
background-color: #eeeeee;
opacity: 1;
}
.form-control[disabled],
fieldset[disabled] .form-control {
cursor: not-allowed;
}
textarea.form-control {
height: auto;
}
@media screen and (-webkit-min-device-pixel-ratio: 0) {
input[type="date"].form-control,
input[type="time"].form-control,
input[type="datetime-local"].form-control,
input[type="month"].form-control {
line-height: 34px;
}
input[type="date"].input-sm,
input[type="time"].input-sm,
input[type="datetime-local"].input-sm,
input[type="month"].input-sm,
.input-group-sm input[type="date"],
.input-group-sm input[type="time"],
.input-group-sm input[type="datetime-local"],
.input-group-sm input[type="month"] {
line-height: 30px;
}
input[type="date"].input-lg,
input[type="time"].input-lg,
input[type="datetime-local"].input-lg,
input[type="month"].input-lg,
.input-group-lg input[type="date"],
.input-group-lg input[type="time"],
.input-group-lg input[type="datetime-local"],
.input-group-lg input[type="month"] {
line-height: 46px;
}
}
.form-group {
margin-bottom: 15px;
}
.radio,
.checkbox {
position: relative;
display: block;
margin-top: 10px;
margin-bottom: 10px;
}
.radio.disabled label,
.checkbox.disabled label,
fieldset[disabled] .radio label,
fieldset[disabled] .checkbox label {
cursor: not-allowed;
}
.radio label,
.checkbox label {
min-height: 20px;
padding-left: 20px;
margin-bottom: 0;
font-weight: 400;
cursor: pointer;
}
.radio input[type="radio"],
.radio-inline input[type="radio"],
.checkbox input[type="checkbox"],
.checkbox-inline input[type="checkbox"] {
position: absolute;
margin-top: 4px \9;
margin-left: -20px;
}
.radio + .radio,
.checkbox + .checkbox {
margin-top: -5px;
}
.radio-inline,
.checkbox-inline {
position: relative;
display: inline-block;
padding-left: 20px;
margin-bottom: 0;
font-weight: 400;
vertical-align: middle;
cursor: pointer;
}
.radio-inline.disabled,
.checkbox-inline.disabled,
fieldset[disabled] .radio-inline,
fieldset[disabled] .checkbox-inline {
cursor: not-allowed;
}
.radio-inline + .radio-inline,
.checkbox-inline + .checkbox-inline {
margin-top: 0;
margin-left: 10px;
}
.form-control-static {
min-height: 34px;
padding-top: 7px;
padding-bottom: 7px;
margin-bottom: 0;
}
.form-control-static.input-lg,
.form-control-static.input-sm {
padding-right: 0;
padding-left: 0;
}
.input-sm {
height: 30px;
padding: 5px 10px;
font-size: 12px;
line-height: 1.5;
border-radius: 3px;
}
select.input-sm {
height: 30px;
line-height: 30px;
}
textarea.input-sm,
select[multiple].input-sm {
height: auto;
}
.form-group-sm .form-control {
height: 30px;
padding: 5px 10px;
font-size: 12px;
line-height: 1.5;
border-radius: 3px;
}
.form-group-sm select.form-control {
height: 30px;
line-height: 30px;
}
.form-group-sm textarea.form-control,
.form-group-sm select[multiple].form-control {
height: auto;
}
.form-group-sm .form-control-static {
height: 30px;
min-height: 32px;
padding: 6px 10px;
font-size: 12px;
line-height: 1.5;
}
.input-lg {
height: 46px;
padding: 10px 16px;
font-size: 18px;
line-height: 1.3333333;
border-radius: 6px;
}
select.input-lg {
height: 46px;
line-height: 46px;
}
textarea.input-lg,
select[multiple].input-lg {
height: auto;
}
.form-group-lg .form-control {
height: 46px;
padding: 10px 16px;
font-size: 18px;
line-height: 1.3333333;
border-radius: 6px;
}
.form-group-lg select.form-control {
height: 46px;
line-height: 46px;
}
.form-group-lg textarea.form-control,
.form-group-lg select[multiple].form-control {
height: auto;
}
.form-group-lg .form-control-static {
height: 46px;
min-height: 38px;
padding: 11px 16px;
font-size: 18px;
line-height: 1.3333333;
}
.has-feedback {
position: relative;
}
.has-feedback .form-control {
padding-right: 42.5px;
}
.form-control-feedback {
position: absolute;
top: 0;
right: 0;
z-index: 2;
display: block;
width: 34px;
height: 34px;
line-height: 34px;
text-align: center;
pointer-events: none;
}
.input-lg + .form-control-feedback,
.input-group-lg + .form-control-feedback,
.form-group-lg .form-control + .form-control-feedback {
width: 46px;
height: 46px;
line-height: 46px;
}
.input-sm + .form-control-feedback,
.input-group-sm + .form-control-feedback,
.form-group-sm .form-control + .form-control-feedback {
width: 30px;
height: 30px;
line-height: 30px;
}
.has-success .help-block,
.has-success .control-label,
.has-success .radio,
.has-success .checkbox,
.has-success .radio-inline,
.has-success .checkbox-inline,
.has-success.radio label,
.has-success.checkbox label,
.has-success.radio-inline label,
.has-success.checkbox-inline label {
color: #3c763d;
}
.has-success .form-control {
border-color: #3c763d;
-webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
}
.has-success .form-control:focus {
border-color: #2b542c;
-webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 6px #67b168;
box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 6px #67b168;
}
.has-success .input-group-addon {
color: #3c763d;
background-color: #dff0d8;
border-color: #3c763d;
}
.has-success .form-control-feedback {
color: #3c763d;
}
.has-warning .help-block,
.has-warning .control-label,
.has-warning .radio,
.has-warning .checkbox,
.has-warning .radio-inline,
.has-warning .checkbox-inline,
.has-warning.radio label,
.has-warning.checkbox label,
.has-warning.radio-inline label,
.has-warning.checkbox-inline label {
color: #8a6d3b;
}
.has-warning .form-control {
border-color: #8a6d3b;
-webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
}
.has-warning .form-control:focus {
border-color: #66512c;
-webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 6px #c0a16b;
box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 6px #c0a16b;
}
.has-warning .input-group-addon {
color: #8a6d3b;
background-color: #fcf8e3;
border-color: #8a6d3b;
}
.has-warning .form-control-feedback {
color: #8a6d3b;
}
.has-error .help-block,
.has-error .control-label,
.has-error .radio,
.has-error .checkbox,
.has-error .radio-inline,
.has-error .checkbox-inline,
.has-error.radio label,
.has-error.checkbox label,
.has-error.radio-inline label,
.has-error.checkbox-inline label {
color: #a94442;
}
.has-error .form-control {
border-color: #a94442;
-webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
}
.has-error .form-control:focus {
border-color: #843534;
-webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 6px #ce8483;
box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075), 0 0 6px #ce8483;
}
.has-error .input-group-addon {
color: #a94442;
background-color: #f2dede;
border-color: #a94442;
}
.has-error .form-control-feedback {
color: #a94442;
}
.has-feedback label ~ .form-control-feedback {
top: 25px;
}
.has-feedback label.sr-only ~ .form-control-feedback {
top: 0;
}
.help-block {
display: block;
margin-top: 5px;
margin-bottom: 10px;
color: #737373;
}
@media (min-width: 768px) {
.form-inline .form-group {
display: inline-block;
margin-bottom: 0;
vertical-align: middle;
}
.form-inline .form-control {
display: inline-block;
width: auto;
vertical-align: middle;
}
.form-inline .form-control-static {
display: inline-block;
}
.form-inline .input-group {
display: inline-table;
vertical-align: middle;
}
.form-inline .input-group .input-group-addon,
.form-inline .input-group .input-group-btn,
.form-inline .input-group .form-control {
width: auto;
}
.form-inline .input-group > .form-control {
width: 100%;
}
.form-inline .control-label {
margin-bottom: 0;
vertical-align: middle;
}
.form-inline .radio,
.form-inline .checkbox {
display: inline-block;
margin-top: 0;
margin-bottom: 0;
vertical-align: middle;
}
.form-inline .radio label,
.form-inline .checkbox label {
padding-left: 0;
}
.form-inline .radio input[type="radio"],
.form-inline .checkbox input[type="checkbox"] {
position: relative;
margin-left: 0;
}
.form-inline .has-feedback .form-control-feedback {
top: 0;
}
}
.form-horizontal .radio,
.form-horizontal .checkbox,
.form-horizontal .radio-inline,
.form-horizontal .checkbox-inline {
padding-top: 7px;
margin-top: 0;
margin-bottom: 0;
}
.form-horizontal .radio,
.form-horizontal .checkbox {
min-height: 27px;
}
.form-horizontal .form-group {
margin-right: -15px;
margin-left: -15px;
}
@media (min-width: 768px) {
.form-horizontal .control-label {
padding-top: 7px;
margin-bottom: 0;
text-align: right;
}
}
.form-horizontal .has-feedback .form-control-feedback {
right: 15px;
}
@media (min-width: 768px) {
.form-horizontal .form-group-lg .control-label {
padding-top: 11px;
font-size: 18px;
}
}
@media (min-width: 768px) {
.form-horizontal .form-group-sm .control-label {
padding-top: 6px;
font-size: 12px;
}
}
.btn {
display: inline-block;
margin-bottom: 0;
font-weight: normal;
text-align: center;
white-space: nowrap;
vertical-align: middle;
-ms-touch-action: manipulation;
touch-action: manipulation;
cursor: pointer;
background-image: none;
border: 1px solid transparent;
padding: 6px 12px;
font-size: 14px;
line-height: 1.42857143;
border-radius: 4px;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
.btn:focus,
.btn:active:focus,
.btn.active:focus,
.btn.focus,
.btn:active.focus,
.btn.active.focus {
outline: 5px auto -webkit-focus-ring-color;
outline-offset: -2px;
}
.btn:hover,
.btn:focus,
.btn.focus {
color: #333;
text-decoration: none;
}
.btn:active,
.btn.active {
background-image: none;
outline: 0;
-webkit-box-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125);
box-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125);
}
.btn.disabled,
.btn[disabled],
fieldset[disabled] .btn {
cursor: not-allowed;
filter: alpha(opacity=65);
opacity: 0.65;
-webkit-box-shadow: none;
box-shadow: none;
}
a.btn.disabled,
fieldset[disabled] a.btn {
pointer-events: none;
}
.btn-default {
color: #333;
background-color: #fff;
border-color: #ccc;
}
.btn-default:focus,
.btn-default.focus {
color: #333;
background-color: #e6e6e6;
border-color: #8c8c8c;
}
.btn-default:hover {
color: #333;
background-color: #e6e6e6;
border-color: #adadad;
}
.btn-default:active,
.btn-default.active,
.open > .dropdown-toggle.btn-default {
color: #333;
background-color: #e6e6e6;
background-image: none;
border-color: #adadad;
}
.btn-default:active:hover,
.btn-default.active:hover,
.open > .dropdown-toggle.btn-default:hover,
.btn-default:active:focus,
.btn-default.active:focus,
.open > .dropdown-toggle.btn-default:focus,
.btn-default:active.focus,
.btn-default.active.focus,
.open > .dropdown-toggle.btn-default.focus {
color: #333;
background-color: #d4d4d4;
border-color: #8c8c8c;
}
.btn-default.disabled:hover,
.btn-default[disabled]:hover,
fieldset[disabled] .btn-default:hover,
.btn-default.disabled:focus,
.btn-default[disabled]:focus,
fieldset[disabled] .btn-default:focus,
.btn-default.disabled.focus,
.btn-default[disabled].focus,
fieldset[disabled] .btn-default.focus {
background-color: #fff;
border-color: #ccc;
}
.btn-default .badge {
color: #fff;
background-color: #333;
}
.btn-primary {
color: #fff;
background-color: #337ab7;
border-color: #2e6da4;
}
.btn-primary:focus,
.btn-primary.focus {
color: #fff;
background-color: #286090;
border-color: #122b40;
}
.btn-primary:hover {
color: #fff;
background-color: #286090;
border-color: #204d74;
}
.btn-primary:active,
.btn-primary.active,
.open > .dropdown-toggle.btn-primary {
color: #fff;
background-color: #286090;
background-image: none;
border-color: #204d74;
}
.btn-primary:active:hover,
.btn-primary.active:hover,
.open > .dropdown-toggle.btn-primary:hover,
.btn-primary:active:focus,
.btn-primary.active:focus,
.open > .dropdown-toggle.btn-primary:focus,
.btn-primary:active.focus,
.btn-primary.active.focus,
.open > .dropdown-toggle.btn-primary.focus {
color: #fff;
background-color: #204d74;
border-color: #122b40;
}
.btn-primary.disabled:hover,
.btn-primary[disabled]:hover,
fieldset[disabled] .btn-primary:hover,
.btn-primary.disabled:focus,
.btn-primary[disabled]:focus,
fieldset[disabled] .btn-primary:focus,
.btn-primary.disabled.focus,
.btn-primary[disabled].focus,
fieldset[disabled] .btn-primary.focus {
background-color: #337ab7;
border-color: #2e6da4;
}
.btn-primary .badge {
color: #337ab7;
background-color: #fff;
}
.btn-success {
color: #fff;
background-color: #5cb85c;
border-color: #4cae4c;
}
.btn-success:focus,
.btn-success.focus {
color: #fff;
background-color: #449d44;
border-color: #255625;
}
.btn-success:hover {
color: #fff;
background-color: #449d44;
border-color: #398439;
}
.btn-success:active,
.btn-success.active,
.open > .dropdown-toggle.btn-success {
color: #fff;
background-color: #449d44;
background-image: none;
border-color: #398439;
}
.btn-success:active:hover,
.btn-success.active:hover,
.open > .dropdown-toggle.btn-success:hover,
.btn-success:active:focus,
.btn-success.active:focus,
.open > .dropdown-toggle.btn-success:focus,
.btn-success:active.focus,
.btn-success.active.focus,
.open > .dropdown-toggle.btn-success.focus {
color: #fff;
background-color: #398439;
border-color: #255625;
}
.btn-success.disabled:hover,
.btn-success[disabled]:hover,
fieldset[disabled] .btn-success:hover,
.btn-success.disabled:focus,
.btn-success[disabled]:focus,
fieldset[disabled] .btn-success:focus,
.btn-success.disabled.focus,
.btn-success[disabled].focus,
fieldset[disabled] .btn-success.focus {
background-color: #5cb85c;
border-color: #4cae4c;
}
.btn-success .badge {
color: #5cb85c;
background-color: #fff;
}
.btn-info {
color: #fff;
background-color: #5bc0de;
border-color: #46b8da;
}
.btn-info:focus,
.btn-info.focus {
color: #fff;
background-color: #31b0d5;
border-color: #1b6d85;
}
.btn-info:hover {
color: #fff;
background-color: #31b0d5;
border-color: #269abc;
}
.btn-info:active,
.btn-info.active,
.open > .dropdown-toggle.btn-info {
color: #fff;
background-color: #31b0d5;
background-image: none;
border-color: #269abc;
}
.btn-info:active:hover,
.btn-info.active:hover,
.open > .dropdown-toggle.btn-info:hover,
.btn-info:active:focus,
.btn-info.active:focus,
.open > .dropdown-toggle.btn-info:focus,
.btn-info:active.focus,
.btn-info.active.focus,
.open > .dropdown-toggle.btn-info.focus {
color: #fff;
background-color: #269abc;
border-color: #1b6d85;
}
.btn-info.disabled:hover,
.btn-info[disabled]:hover,
fieldset[disabled] .btn-info:hover,
.btn-info.disabled:focus,
.btn-info[disabled]:focus,
fieldset[disabled] .btn-info:focus,
.btn-info.disabled.focus,
.btn-info[disabled].focus,
fieldset[disabled] .btn-info.focus {
background-color: #5bc0de;
border-color: #46b8da;
}
.btn-info .badge {
color: #5bc0de;
background-color: #fff;
}
.btn-warning {
color: #fff;
background-color: #f0ad4e;
border-color: #eea236;
}
.btn-warning:focus,
.btn-warning.focus {
color: #fff;
background-color: #ec971f;
border-color: #985f0d;
}
.btn-warning:hover {
color: #fff;
background-color: #ec971f;
border-color: #d58512;
}
.btn-warning:active,
.btn-warning.active,
.open > .dropdown-toggle.btn-warning {
color: #fff;
background-color: #ec971f;
background-image: none;
border-color: #d58512;
}
.btn-warning:active:hover,
.btn-warning.active:hover,
.open > .dropdown-toggle.btn-warning:hover,
.btn-warning:active:focus,
.btn-warning.active:focus,
.open > .dropdown-toggle.btn-warning:focus,
.btn-warning:active.focus,
.btn-warning.active.focus,
.open > .dropdown-toggle.btn-warning.focus {
color: #fff;
background-color: #d58512;
border-color: #985f0d;
}
.btn-warning.disabled:hover,
.btn-warning[disabled]:hover,
fieldset[disabled] .btn-warning:hover,
.btn-warning.disabled:focus,
.btn-warning[disabled]:focus,
fieldset[disabled] .btn-warning:focus,
.btn-warning.disabled.focus,
.btn-warning[disabled].focus,
fieldset[disabled] .btn-warning.focus {
background-color: #f0ad4e;
border-color: #eea236;
}
.btn-warning .badge {
color: #f0ad4e;
background-color: #fff;
}
.btn-danger {
color: #fff;
background-color: #d9534f;
border-color: #d43f3a;
}
.btn-danger:focus,
.btn-danger.focus {
color: #fff;
background-color: #c9302c;
border-color: #761c19;
}
.btn-danger:hover {
color: #fff;
background-color: #c9302c;
border-color: #ac2925;
}
.btn-danger:active,
.btn-danger.active,
.open > .dropdown-toggle.btn-danger {
color: #fff;
background-color: #c9302c;
background-image: none;
border-color: #ac2925;
}
.btn-danger:active:hover,
.btn-danger.active:hover,
.open > .dropdown-toggle.btn-danger:hover,
.btn-danger:active:focus,
.btn-danger.active:focus,
.open > .dropdown-toggle.btn-danger:focus,
.btn-danger:active.focus,
.btn-danger.active.focus,
.open > .dropdown-toggle.btn-danger.focus {
color: #fff;
background-color: #ac2925;
border-color: #761c19;
}
.btn-danger.disabled:hover,
.btn-danger[disabled]:hover,
fieldset[disabled] .btn-danger:hover,
.btn-danger.disabled:focus,
.btn-danger[disabled]:focus,
fieldset[disabled] .btn-danger:focus,
.btn-danger.disabled.focus,
.btn-danger[disabled].focus,
fieldset[disabled] .btn-danger.focus {
background-color: #d9534f;
border-color: #d43f3a;
}
.btn-danger .badge {
color: #d9534f;
background-color: #fff;
}
.btn-link {
font-weight: 400;
color: #337ab7;
border-radius: 0;
}
.btn-link,
.btn-link:active,
.btn-link.active,
.btn-link[disabled],
fieldset[disabled] .btn-link {
background-color: transparent;
-webkit-box-shadow: none;
box-shadow: none;
}
.btn-link,
.btn-link:hover,
.btn-link:focus,
.btn-link:active {
border-color: transparent;
}
.btn-link:hover,
.btn-link:focus {
color: #23527c;
text-decoration: underline;
background-color: transparent;
}
.btn-link[disabled]:hover,
fieldset[disabled] .btn-link:hover,
.btn-link[disabled]:focus,
fieldset[disabled] .btn-link:focus {
color: #777777;
text-decoration: none;
}
.btn-lg,
.btn-group-lg > .btn {
padding: 10px 16px;
font-size: 18px;
line-height: 1.3333333;
border-radius: 6px;
}
.btn-sm,
.btn-group-sm > .btn {
padding: 5px 10px;
font-size: 12px;
line-height: 1.5;
border-radius: 3px;
}
.btn-xs,
.btn-group-xs > .btn {
padding: 1px 5px;
font-size: 12px;
line-height: 1.5;
border-radius: 3px;
}
.btn-block {
display: block;
width: 100%;
}
.btn-block + .btn-block {
margin-top: 5px;
}
input[type="submit"].btn-block,
input[type="reset"].btn-block,
input[type="button"].btn-block {
width: 100%;
}
.fade {
opacity: 0;
-webkit-transition: opacity 0.15s linear;
-o-transition: opacity 0.15s linear;
transition: opacity 0.15s linear;
}
.fade.in {
opacity: 1;
}
.collapse {
display: none;
}
.collapse.in {
display: block;
}
tr.collapse.in {
display: table-row;
}
tbody.collapse.in {
display: table-row-group;
}
.collapsing {
position: relative;
height: 0;
overflow: hidden;
-webkit-transition-property: height, visibility;
-o-transition-property: height, visibility;
transition-property: height, visibility;
-webkit-transition-duration: 0.35s;
-o-transition-duration: 0.35s;
transition-duration: 0.35s;
-webkit-transition-timing-function: ease;
-o-transition-timing-function: ease;
transition-timing-function: ease;
}
.caret {
display: inline-block;
width: 0;
height: 0;
margin-left: 2px;
vertical-align: middle;
border-top: 4px dashed;
border-top: 4px solid \9;
border-right: 4px solid transparent;
border-left: 4px solid transparent;
}
.dropup,
.dropdown {
position: relative;
}
.dropdown-toggle:focus {
outline: 0;
}
.dropdown-menu {
position: absolute;
top: 100%;
left: 0;
z-index: 1000;
display: none;
float: left;
min-width: 160px;
padding: 5px 0;
margin: 2px 0 0;
font-size: 14px;
text-align: left;
list-style: none;
background-color: #fff;
background-clip: padding-box;
border: 1px solid #ccc;
border: 1px solid rgba(0, 0, 0, 0.15);
border-radius: 4px;
-webkit-box-shadow: 0 6px 12px rgba(0, 0, 0, 0.175);
box-shadow: 0 6px 12px rgba(0, 0, 0, 0.175);
}
.dropdown-menu.pull-right {
right: 0;
left: auto;
}
.dropdown-menu .divider {
height: 1px;
margin: 9px 0;
overflow: hidden;
background-color: #e5e5e5;
}
.dropdown-menu > li > a {
display: block;
padding: 3px 20px;
clear: both;
font-weight: 400;
line-height: 1.42857143;
color: #333333;
white-space: nowrap;
}
.dropdown-menu > li > a:hover,
.dropdown-menu > li > a:focus {
color: #262626;
text-decoration: none;
background-color: #f5f5f5;
}
.dropdown-menu > .active > a,
.dropdown-menu > .active > a:hover,
.dropdown-menu > .active > a:focus {
color: #fff;
text-decoration: none;
background-color: #337ab7;
outline: 0;
}
.dropdown-menu > .disabled > a,
.dropdown-menu > .disabled > a:hover,
.dropdown-menu > .disabled > a:focus {
color: #777777;
}
.dropdown-menu > .disabled > a:hover,
.dropdown-menu > .disabled > a:focus {
text-decoration: none;
cursor: not-allowed;
background-color: transparent;
background-image: none;
filter: progid:DXImageTransform.Microsoft.gradient(enabled = false);
}
.open > .dropdown-menu {
display: block;
}
.open > a {
outline: 0;
}
.dropdown-menu-right {
right: 0;
left: auto;
}
.dropdown-menu-left {
right: auto;
left: 0;
}
.dropdown-header {
display: block;
padding: 3px 20px;
font-size: 12px;
line-height: 1.42857143;
color: #777777;
white-space: nowrap;
}
.dropdown-backdrop {
position: fixed;
top: 0;
right: 0;
bottom: 0;
left: 0;
z-index: 990;
}
.pull-right > .dropdown-menu {
right: 0;
left: auto;
}
.dropup .caret,
.navbar-fixed-bottom .dropdown .caret {
content: "";
border-top: 0;
border-bottom: 4px dashed;
border-bottom: 4px solid \9;
}
.dropup .dropdown-menu,
.navbar-fixed-bottom .dropdown .dropdown-menu {
top: auto;
bottom: 100%;
margin-bottom: 2px;
}
@media (min-width: 768px) {
.navbar-right .dropdown-menu {
right: 0;
left: auto;
}
.navbar-right .dropdown-menu-left {
right: auto;
left: 0;
}
}
.btn-group,
.btn-group-vertical {
position: relative;
display: inline-block;
vertical-align: middle;
}
.btn-group > .btn,
.btn-group-vertical > .btn {
position: relative;
float: left;
}
.btn-group > .btn:hover,
.btn-group-vertical > .btn:hover,
.btn-group > .btn:focus,
.btn-group-vertical > .btn:focus,
.btn-group > .btn:active,
.btn-group-vertical > .btn:active,
.btn-group > .btn.active,
.btn-group-vertical > .btn.active {
z-index: 2;
}
.btn-group .btn + .btn,
.btn-group .btn + .btn-group,
.btn-group .btn-group + .btn,
.btn-group .btn-group + .btn-group {
margin-left: -1px;
}
.btn-toolbar {
margin-left: -5px;
}
.btn-toolbar .btn,
.btn-toolbar .btn-group,
.btn-toolbar .input-group {
float: left;
}
.btn-toolbar > .btn,
.btn-toolbar > .btn-group,
.btn-toolbar > .input-group {
margin-left: 5px;
}
.btn-group > .btn:not(:first-child):not(:last-child):not(.dropdown-toggle) {
border-radius: 0;
}
.btn-group > .btn:first-child {
margin-left: 0;
}
.btn-group > .btn:first-child:not(:last-child):not(.dropdown-toggle) {
border-top-right-radius: 0;
border-bottom-right-radius: 0;
}
.btn-group > .btn:last-child:not(:first-child),
.btn-group > .dropdown-toggle:not(:first-child) {
border-top-left-radius: 0;
border-bottom-left-radius: 0;
}
.btn-group > .btn-group {
float: left;
}
.btn-group > .btn-group:not(:first-child):not(:last-child) > .btn {
border-radius: 0;
}
.btn-group > .btn-group:first-child:not(:last-child) > .btn:last-child,
.btn-group > .btn-group:first-child:not(:last-child) > .dropdown-toggle {
border-top-right-radius: 0;
border-bottom-right-radius: 0;
}
.btn-group > .btn-group:last-child:not(:first-child) > .btn:first-child {
border-top-left-radius: 0;
border-bottom-left-radius: 0;
}
.btn-group .dropdown-toggle:active,
.btn-group.open .dropdown-toggle {
outline: 0;
}
.btn-group > .btn + .dropdown-toggle {
padding-right: 8px;
padding-left: 8px;
}
.btn-group > .btn-lg + .dropdown-toggle {
padding-right: 12px;
padding-left: 12px;
}
.btn-group.open .dropdown-toggle {
-webkit-box-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125);
box-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.125);
}
.btn-group.open .dropdown-toggle.btn-link {
-webkit-box-shadow: none;
box-shadow: none;
}
.btn .caret {
margin-left: 0;
}
.btn-lg .caret {
border-width: 5px 5px 0;
border-bottom-width: 0;
}
.dropup .btn-lg .caret {
border-width: 0 5px 5px;
}
.btn-group-vertical > .btn,
.btn-group-vertical > .btn-group,
.btn-group-vertical > .btn-group > .btn {
display: block;
float: none;
width: 100%;
max-width: 100%;
}
.btn-group-vertical > .btn-group > .btn {
float: none;
}
.btn-group-vertical > .btn + .btn,
.btn-group-vertical > .btn + .btn-group,
.btn-group-vertical > .btn-group + .btn,
.btn-group-vertical > .btn-group + .btn-group {
margin-top: -1px;
margin-left: 0;
}
.btn-group-vertical > .btn:not(:first-child):not(:last-child) {
border-radius: 0;
}
.btn-group-vertical > .btn:first-child:not(:last-child) {
border-top-left-radius: 4px;
border-top-right-radius: 4px;
border-bottom-right-radius: 0;
border-bottom-left-radius: 0;
}
.btn-group-vertical > .btn:last-child:not(:first-child) {
border-top-left-radius: 0;
border-top-right-radius: 0;
border-bottom-right-radius: 4px;
border-bottom-left-radius: 4px;
}
.btn-group-vertical > .btn-group:not(:first-child):not(:last-child) > .btn {
border-radius: 0;
}
.btn-group-vertical > .btn-group:first-child:not(:last-child) > .btn:last-child,
.btn-group-vertical > .btn-group:first-child:not(:last-child) > .dropdown-toggle {
border-bottom-right-radius: 0;
border-bottom-left-radius: 0;
}
.btn-group-vertical > .btn-group:last-child:not(:first-child) > .btn:first-child {
border-top-left-radius: 0;
border-top-right-radius: 0;
}
.btn-group-justified {
display: table;
width: 100%;
table-layout: fixed;
border-collapse: separate;
}
.btn-group-justified > .btn,
.btn-group-justified > .btn-group {
display: table-cell;
float: none;
width: 1%;
}
.btn-group-justified > .btn-group .btn {
width: 100%;
}
.btn-group-justified > .btn-group .dropdown-menu {
left: auto;
}
[data-toggle="buttons"] > .btn input[type="radio"],
[data-toggle="buttons"] > .btn-group > .btn input[type="radio"],
[data-toggle="buttons"] > .btn input[type="checkbox"],
[data-toggle="buttons"] > .btn-group > .btn input[type="checkbox"] {
position: absolute;
clip: rect(0, 0, 0, 0);
pointer-events: none;
}
.input-group {
position: relative;
display: table;
border-collapse: separate;
}
.input-group[class*="col-"] {
float: none;
padding-right: 0;
padding-left: 0;
}
.input-group .form-control {
position: relative;
z-index: 2;
float: left;
width: 100%;
margin-bottom: 0;
}
.input-group .form-control:focus {
z-index: 3;
}
.input-group-lg > .form-control,
.input-group-lg > .input-group-addon,
.input-group-lg > .input-group-btn > .btn {
height: 46px;
padding: 10px 16px;
font-size: 18px;
line-height: 1.3333333;
border-radius: 6px;
}
select.input-group-lg > .form-control,
select.input-group-lg > .input-group-addon,
select.input-group-lg > .input-group-btn > .btn {
height: 46px;
line-height: 46px;
}
textarea.input-group-lg > .form-control,
textarea.input-group-lg > .input-group-addon,
textarea.input-group-lg > .input-group-btn > .btn,
select[multiple].input-group-lg > .form-control,
select[multiple].input-group-lg > .input-group-addon,
select[multiple].input-group-lg > .input-group-btn > .btn {
height: auto;
}
.input-group-sm > .form-control,
.input-group-sm > .input-group-addon,
.input-group-sm > .input-group-btn > .btn {
height: 30px;
padding: 5px 10px;
font-size: 12px;
line-height: 1.5;
border-radius: 3px;
}
select.input-group-sm > .form-control,
select.input-group-sm > .input-group-addon,
select.input-group-sm > .input-group-btn > .btn {
height: 30px;
line-height: 30px;
}
textarea.input-group-sm > .form-control,
textarea.input-group-sm > .input-group-addon,
textarea.input-group-sm > .input-group-btn > .btn,
select[multiple].input-group-sm > .form-control,
select[multiple].input-group-sm > .input-group-addon,
select[multiple].input-group-sm > .input-group-btn > .btn {
height: auto;
}
.input-group-addon,
.input-group-btn,
.input-group .form-control {
display: table-cell;
}
.input-group-addon:not(:first-child):not(:last-child),
.input-group-btn:not(:first-child):not(:last-child),
.input-group .form-control:not(:first-child):not(:last-child) {
border-radius: 0;
}
.input-group-addon,
.input-group-btn {
width: 1%;
white-space: nowrap;
vertical-align: middle;
}
.input-group-addon {
padding: 6px 12px;
font-size: 14px;
font-weight: 400;
line-height: 1;
color: #555555;
text-align: center;
background-color: #eeeeee;
border: 1px solid #ccc;
border-radius: 4px;
}
.input-group-addon.input-sm {
padding: 5px 10px;
font-size: 12px;
border-radius: 3px;
}
.input-group-addon.input-lg {
padding: 10px 16px;
font-size: 18px;
border-radius: 6px;
}
.input-group-addon input[type="radio"],
.input-group-addon input[type="checkbox"] {
margin-top: 0;
}
.input-group .form-control:first-child,
.input-group-addon:first-child,
.input-group-btn:first-child > .btn,
.input-group-btn:first-child > .btn-group > .btn,
.input-group-btn:first-child > .dropdown-toggle,
.input-group-btn:last-child > .btn:not(:last-child):not(.dropdown-toggle),
.input-group-btn:last-child > .btn-group:not(:last-child) > .btn {
border-top-right-radius: 0;
border-bottom-right-radius: 0;
}
.input-group-addon:first-child {
border-right: 0;
}
.input-group .form-control:last-child,
.input-group-addon:last-child,
.input-group-btn:last-child > .btn,
.input-group-btn:last-child > .btn-group > .btn,
.input-group-btn:last-child > .dropdown-toggle,
.input-group-btn:first-child > .btn:not(:first-child),
.input-group-btn:first-child > .btn-group:not(:first-child) > .btn {
border-top-left-radius: 0;
border-bottom-left-radius: 0;
}
.input-group-addon:last-child {
border-left: 0;
}
.input-group-btn {
position: relative;
font-size: 0;
white-space: nowrap;
}
.input-group-btn > .btn {
position: relative;
}
.input-group-btn > .btn + .btn {
margin-left: -1px;
}
.input-group-btn > .btn:hover,
.input-group-btn > .btn:focus,
.input-group-btn > .btn:active {
z-index: 2;
}
.input-group-btn:first-child > .btn,
.input-group-btn:first-child > .btn-group {
margin-right: -1px;
}
.input-group-btn:last-child > .btn,
.input-group-btn:last-child > .btn-group {
z-index: 2;
margin-left: -1px;
}
.nav {
padding-left: 0;
margin-bottom: 0;
list-style: none;
}
.nav > li {
position: relative;
display: block;
}
.nav > li > a {
position: relative;
display: block;
padding: 10px 15px;
}
.nav > li > a:hover,
.nav > li > a:focus {
text-decoration: none;
background-color: #eeeeee;
}
.nav > li.disabled > a {
color: #777777;
}
.nav > li.disabled > a:hover,
.nav > li.disabled > a:focus {
color: #777777;
text-decoration: none;
cursor: not-allowed;
background-color: transparent;
}
.nav .open > a,
.nav .open > a:hover,
.nav .open > a:focus {
background-color: #eeeeee;
border-color: #337ab7;
}
.nav .nav-divider {
height: 1px;
margin: 9px 0;
overflow: hidden;
background-color: #e5e5e5;
}
.nav > li > a > img {
max-width: none;
}
.nav-tabs {
border-bottom: 1px solid #ddd;
}
.nav-tabs > li {
float: left;
margin-bottom: -1px;
}
.nav-tabs > li > a {
margin-right: 2px;
line-height: 1.42857143;
border: 1px solid transparent;
border-radius: 4px 4px 0 0;
}
.nav-tabs > li > a:hover {
border-color: #eeeeee #eeeeee #ddd;
}
.nav-tabs > li.active > a,
.nav-tabs > li.active > a:hover,
.nav-tabs > li.active > a:focus {
color: #555555;
cursor: default;
background-color: #fff;
border: 1px solid #ddd;
border-bottom-color: transparent;
}
.nav-tabs.nav-justified {
width: 100%;
border-bottom: 0;
}
.nav-tabs.nav-justified > li {
float: none;
}
.nav-tabs.nav-justified > li > a {
margin-bottom: 5px;
text-align: center;
}
.nav-tabs.nav-justified > .dropdown .dropdown-menu {
top: auto;
left: auto;
}
@media (min-width: 768px) {
.nav-tabs.nav-justified > li {
display: table-cell;
width: 1%;
}
.nav-tabs.nav-justified > li > a {
margin-bottom: 0;
}
}
.nav-tabs.nav-justified > li > a {
margin-right: 0;
border-radius: 4px;
}
.nav-tabs.nav-justified > .active > a,
.nav-tabs.nav-justified > .active > a:hover,
.nav-tabs.nav-justified > .active > a:focus {
border: 1px solid #ddd;
}
@media (min-width: 768px) {
.nav-tabs.nav-justified > li > a {
border-bottom: 1px solid #ddd;
border-radius: 4px 4px 0 0;
}
.nav-tabs.nav-justified > .active > a,
.nav-tabs.nav-justified > .active > a:hover,
.nav-tabs.nav-justified > .active > a:focus {
border-bottom-color: #fff;
}
}
.nav-pills > li {
float: left;
}
.nav-pills > li > a {
border-radius: 4px;
}
.nav-pills > li + li {
margin-left: 2px;
}
.nav-pills > li.active > a,
.nav-pills > li.active > a:hover,
.nav-pills > li.active > a:focus {
color: #fff;
background-color: #337ab7;
}
.nav-stacked > li {
float: none;
}
.nav-stacked > li + li {
margin-top: 2px;
margin-left: 0;
}
.nav-justified {
width: 100%;
}
.nav-justified > li {
float: none;
}
.nav-justified > li > a {
margin-bottom: 5px;
text-align: center;
}
.nav-justified > .dropdown .dropdown-menu {
top: auto;
left: auto;
}
@media (min-width: 768px) {
.nav-justified > li {
display: table-cell;
width: 1%;
}
.nav-justified > li > a {
margin-bottom: 0;
}
}
.nav-tabs-justified {
border-bottom: 0;
}
.nav-tabs-justified > li > a {
margin-right: 0;
border-radius: 4px;
}
.nav-tabs-justified > .active > a,
.nav-tabs-justified > .active > a:hover,
.nav-tabs-justified > .active > a:focus {
border: 1px solid #ddd;
}
@media (min-width: 768px) {
.nav-tabs-justified > li > a {
border-bottom: 1px solid #ddd;
border-radius: 4px 4px 0 0;
}
.nav-tabs-justified > .active > a,
.nav-tabs-justified > .active > a:hover,
.nav-tabs-justified > .active > a:focus {
border-bottom-color: #fff;
}
}
.tab-content > .tab-pane {
display: none;
}
.tab-content > .active {
display: block;
}
.nav-tabs .dropdown-menu {
margin-top: -1px;
border-top-left-radius: 0;
border-top-right-radius: 0;
}
.navbar {
position: relative;
min-height: 50px;
margin-bottom: 20px;
border: 1px solid transparent;
}
@media (min-width: 768px) {
.navbar {
border-radius: 4px;
}
}
@media (min-width: 768px) {
.navbar-header {
float: left;
}
}
.navbar-collapse {
padding-right: 15px;
padding-left: 15px;
overflow-x: visible;
border-top: 1px solid transparent;
-webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1);
box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1);
-webkit-overflow-scrolling: touch;
}
.navbar-collapse.in {
overflow-y: auto;
}
@media (min-width: 768px) {
.navbar-collapse {
width: auto;
border-top: 0;
-webkit-box-shadow: none;
box-shadow: none;
}
.navbar-collapse.collapse {
display: block !important;
height: auto !important;
padding-bottom: 0;
overflow: visible !important;
}
.navbar-collapse.in {
overflow-y: visible;
}
.navbar-fixed-top .navbar-collapse,
.navbar-static-top .navbar-collapse,
.navbar-fixed-bottom .navbar-collapse {
padding-right: 0;
padding-left: 0;
}
}
.navbar-fixed-top,
.navbar-fixed-bottom {
position: fixed;
right: 0;
left: 0;
z-index: 1030;
}
.navbar-fixed-top .navbar-collapse,
.navbar-fixed-bottom .navbar-collapse {
max-height: 340px;
}
@media (max-device-width: 480px) and (orientation: landscape) {
.navbar-fixed-top .navbar-collapse,
.navbar-fixed-bottom .navbar-collapse {
max-height: 200px;
}
}
@media (min-width: 768px) {
.navbar-fixed-top,
.navbar-fixed-bottom {
border-radius: 0;
}
}
.navbar-fixed-top {
top: 0;
border-width: 0 0 1px;
}
.navbar-fixed-bottom {
bottom: 0;
margin-bottom: 0;
border-width: 1px 0 0;
}
.container > .navbar-header,
.container-fluid > .navbar-header,
.container > .navbar-collapse,
.container-fluid > .navbar-collapse {
margin-right: -15px;
margin-left: -15px;
}
@media (min-width: 768px) {
.container > .navbar-header,
.container-fluid > .navbar-header,
.container > .navbar-collapse,
.container-fluid > .navbar-collapse {
margin-right: 0;
margin-left: 0;
}
}
.navbar-static-top {
z-index: 1000;
border-width: 0 0 1px;
}
@media (min-width: 768px) {
.navbar-static-top {
border-radius: 0;
}
}
.navbar-brand {
float: left;
height: 50px;
padding: 15px 15px;
font-size: 18px;
line-height: 20px;
}
.navbar-brand:hover,
.navbar-brand:focus {
text-decoration: none;
}
.navbar-brand > img {
display: block;
}
@media (min-width: 768px) {
.navbar > .container .navbar-brand,
.navbar > .container-fluid .navbar-brand {
margin-left: -15px;
}
}
.navbar-toggle {
position: relative;
float: right;
padding: 9px 10px;
margin-right: 15px;
margin-top: 8px;
margin-bottom: 8px;
background-color: transparent;
background-image: none;
border: 1px solid transparent;
border-radius: 4px;
}
.navbar-toggle:focus {
outline: 0;
}
.navbar-toggle .icon-bar {
display: block;
width: 22px;
height: 2px;
border-radius: 1px;
}
.navbar-toggle .icon-bar + .icon-bar {
margin-top: 4px;
}
@media (min-width: 768px) {
.navbar-toggle {
display: none;
}
}
.navbar-nav {
margin: 7.5px -15px;
}
.navbar-nav > li > a {
padding-top: 10px;
padding-bottom: 10px;
line-height: 20px;
}
@media (max-width: 767px) {
.navbar-nav .open .dropdown-menu {
position: static;
float: none;
width: auto;
margin-top: 0;
background-color: transparent;
border: 0;
-webkit-box-shadow: none;
box-shadow: none;
}
.navbar-nav .open .dropdown-menu > li > a,
.navbar-nav .open .dropdown-menu .dropdown-header {
padding: 5px 15px 5px 25px;
}
.navbar-nav .open .dropdown-menu > li > a {
line-height: 20px;
}
.navbar-nav .open .dropdown-menu > li > a:hover,
.navbar-nav .open .dropdown-menu > li > a:focus {
background-image: none;
}
}
@media (min-width: 768px) {
.navbar-nav {
float: left;
margin: 0;
}
.navbar-nav > li {
float: left;
}
.navbar-nav > li > a {
padding-top: 15px;
padding-bottom: 15px;
}
}
.navbar-form {
padding: 10px 15px;
margin-right: -15px;
margin-left: -15px;
border-top: 1px solid transparent;
border-bottom: 1px solid transparent;
-webkit-box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 1px 0 rgba(255, 255, 255, 0.1);
box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.1), 0 1px 0 rgba(255, 255, 255, 0.1);
margin-top: 8px;
margin-bottom: 8px;
}
@media (min-width: 768px) {
.navbar-form .form-group {
display: inline-block;
margin-bottom: 0;
vertical-align: middle;
}
.navbar-form .form-control {
display: inline-block;
width: auto;
vertical-align: middle;
}
.navbar-form .form-control-static {
display: inline-block;
}
.navbar-form .input-group {
display: inline-table;
vertical-align: middle;
}
.navbar-form .input-group .input-group-addon,
.navbar-form .input-group .input-group-btn,
.navbar-form .input-group .form-control {
width: auto;
}
.navbar-form .input-group > .form-control {
width: 100%;
}
.navbar-form .control-label {
margin-bottom: 0;
vertical-align: middle;
}
.navbar-form .radio,
.navbar-form .checkbox {
display: inline-block;
margin-top: 0;
margin-bottom: 0;
vertical-align: middle;
}
.navbar-form .radio label,
.navbar-form .checkbox label {
padding-left: 0;
}
.navbar-form .radio input[type="radio"],
.navbar-form .checkbox input[type="checkbox"] {
position: relative;
margin-left: 0;
}
.navbar-form .has-feedback .form-control-feedback {
top: 0;
}
}
@media (max-width: 767px) {
.navbar-form .form-group {
margin-bottom: 5px;
}
.navbar-form .form-group:last-child {
margin-bottom: 0;
}
}
@media (min-width: 768px) {
.navbar-form {
width: auto;
padding-top: 0;
padding-bottom: 0;
margin-right: 0;
margin-left: 0;
border: 0;
-webkit-box-shadow: none;
box-shadow: none;
}
}
.navbar-nav > li > .dropdown-menu {
margin-top: 0;
border-top-left-radius: 0;
border-top-right-radius: 0;
}
.navbar-fixed-bottom .navbar-nav > li > .dropdown-menu {
margin-bottom: 0;
border-top-left-radius: 4px;
border-top-right-radius: 4px;
border-bottom-right-radius: 0;
border-bottom-left-radius: 0;
}
.navbar-btn {
margin-top: 8px;
margin-bottom: 8px;
}
.navbar-btn.btn-sm {
margin-top: 10px;
margin-bottom: 10px;
}
.navbar-btn.btn-xs {
margin-top: 14px;
margin-bottom: 14px;
}
.navbar-text {
margin-top: 15px;
margin-bottom: 15px;
}
@media (min-width: 768px) {
.navbar-text {
float: left;
margin-right: 15px;
margin-left: 15px;
}
}
@media (min-width: 768px) {
.navbar-left {
float: left !important;
}
.navbar-right {
float: right !important;
margin-right: -15px;
}
.navbar-right ~ .navbar-right {
margin-right: 0;
}
}
.navbar-default {
background-color: #f8f8f8;
border-color: #e7e7e7;
}
.navbar-default .navbar-brand {
color: #777;
}
.navbar-default .navbar-brand:hover,
.navbar-default .navbar-brand:focus {
color: #5e5e5e;
background-color: transparent;
}
.navbar-default .navbar-text {
color: #777;
}
.navbar-default .navbar-nav > li > a {
color: #777;
}
.navbar-default .navbar-nav > li > a:hover,
.navbar-default .navbar-nav > li > a:focus {
color: #333;
background-color: transparent;
}
.navbar-default .navbar-nav > .active > a,
.navbar-default .navbar-nav > .active > a:hover,
.navbar-default .navbar-nav > .active > a:focus {
color: #555;
background-color: #e7e7e7;
}
.navbar-default .navbar-nav > .disabled > a,
.navbar-default .navbar-nav > .disabled > a:hover,
.navbar-default .navbar-nav > .disabled > a:focus {
color: #ccc;
background-color: transparent;
}
.navbar-default .navbar-nav > .open > a,
.navbar-default .navbar-nav > .open > a:hover,
.navbar-default .navbar-nav > .open > a:focus {
color: #555;
background-color: #e7e7e7;
}
@media (max-width: 767px) {
.navbar-default .navbar-nav .open .dropdown-menu > li > a {
color: #777;
}
.navbar-default .navbar-nav .open .dropdown-menu > li > a:hover,
.navbar-default .navbar-nav .open .dropdown-menu > li > a:focus {
color: #333;
background-color: transparent;
}
.navbar-default .navbar-nav .open .dropdown-menu > .active > a,
.navbar-default .navbar-nav .open .dropdown-menu > .active > a:hover,
.navbar-default .navbar-nav .open .dropdown-menu > .active > a:focus {
color: #555;
background-color: #e7e7e7;
}
.navbar-default .navbar-nav .open .dropdown-menu > .disabled > a,
.navbar-default .navbar-nav .open .dropdown-menu > .disabled > a:hover,
.navbar-default .navbar-nav .open .dropdown-menu > .disabled > a:focus {
color: #ccc;
background-color: transparent;
}
}
.navbar-default .navbar-toggle {
border-color: #ddd;
}
.navbar-default .navbar-toggle:hover,
.navbar-default .navbar-toggle:focus {
background-color: #ddd;
}
.navbar-default .navbar-toggle .icon-bar {
background-color: #888;
}
.navbar-default .navbar-collapse,
.navbar-default .navbar-form {
border-color: #e7e7e7;
}
.navbar-default .navbar-link {
color: #777;
}
.navbar-default .navbar-link:hover {
color: #333;
}
.navbar-default .btn-link {
color: #777;
}
.navbar-default .btn-link:hover,
.navbar-default .btn-link:focus {
color: #333;
}
.navbar-default .btn-link[disabled]:hover,
fieldset[disabled] .navbar-default .btn-link:hover,
.navbar-default .btn-link[disabled]:focus,
fieldset[disabled] .navbar-default .btn-link:focus {
color: #ccc;
}
.navbar-inverse {
background-color: #222;
border-color: #080808;
}
.navbar-inverse .navbar-brand {
color: #9d9d9d;
}
.navbar-inverse .navbar-brand:hover,
.navbar-inverse .navbar-brand:focus {
color: #fff;
background-color: transparent;
}
.navbar-inverse .navbar-text {
color: #9d9d9d;
}
.navbar-inverse .navbar-nav > li > a {
color: #9d9d9d;
}
.navbar-inverse .navbar-nav > li > a:hover,
.navbar-inverse .navbar-nav > li > a:focus {
color: #fff;
background-color: transparent;
}
.navbar-inverse .navbar-nav > .active > a,
.navbar-inverse .navbar-nav > .active > a:hover,
.navbar-inverse .navbar-nav > .active > a:focus {
color: #fff;
background-color: #080808;
}
.navbar-inverse .navbar-nav > .disabled > a,
.navbar-inverse .navbar-nav > .disabled > a:hover,
.navbar-inverse .navbar-nav > .disabled > a:focus {
color: #444;
background-color: transparent;
}
.navbar-inverse .navbar-nav > .open > a,
.navbar-inverse .navbar-nav > .open > a:hover,
.navbar-inverse .navbar-nav > .open > a:focus {
color: #fff;
background-color: #080808;
}
@media (max-width: 767px) {
.navbar-inverse .navbar-nav .open .dropdown-menu > .dropdown-header {
border-color: #080808;
}
.navbar-inverse .navbar-nav .open .dropdown-menu .divider {
background-color: #080808;
}
.navbar-inverse .navbar-nav .open .dropdown-menu > li > a {
color: #9d9d9d;
}
.navbar-inverse .navbar-nav .open .dropdown-menu > li > a:hover,
.navbar-inverse .navbar-nav .open .dropdown-menu > li > a:focus {
color: #fff;
background-color: transparent;
}
.navbar-inverse .navbar-nav .open .dropdown-menu > .active > a,
.navbar-inverse .navbar-nav .open .dropdown-menu > .active > a:hover,
.navbar-inverse .navbar-nav .open .dropdown-menu > .active > a:focus {
color: #fff;
background-color: #080808;
}
.navbar-inverse .navbar-nav .open .dropdown-menu > .disabled > a,
.navbar-inverse .navbar-nav .open .dropdown-menu > .disabled > a:hover,
.navbar-inverse .navbar-nav .open .dropdown-menu > .disabled > a:focus {
color: #444;
background-color: transparent;
}
}
.navbar-inverse .navbar-toggle {
border-color: #333;
}
.navbar-inverse .navbar-toggle:hover,
.navbar-inverse .navbar-toggle:focus {
background-color: #333;
}
.navbar-inverse .navbar-toggle .icon-bar {
background-color: #fff;
}
.navbar-inverse .navbar-collapse,
.navbar-inverse .navbar-form {
border-color: #101010;
}
.navbar-inverse .navbar-link {
color: #9d9d9d;
}
.navbar-inverse .navbar-link:hover {
color: #fff;
}
.navbar-inverse .btn-link {
color: #9d9d9d;
}
.navbar-inverse .btn-link:hover,
.navbar-inverse .btn-link:focus {
color: #fff;
}
.navbar-inverse .btn-link[disabled]:hover,
fieldset[disabled] .navbar-inverse .btn-link:hover,
.navbar-inverse .btn-link[disabled]:focus,
fieldset[disabled] .navbar-inverse .btn-link:focus {
color: #444;
}
.breadcrumb {
padding: 8px 15px;
margin-bottom: 20px;
list-style: none;
background-color: #f5f5f5;
border-radius: 4px;
}
.breadcrumb > li {
display: inline-block;
}
.breadcrumb > li + li:before {
padding: 0 5px;
color: #ccc;
content: "/\00a0";
}
.breadcrumb > .active {
color: #777777;
}
.pagination {
display: inline-block;
padding-left: 0;
margin: 20px 0;
border-radius: 4px;
}
.pagination > li {
display: inline;
}
.pagination > li > a,
.pagination > li > span {
position: relative;
float: left;
padding: 6px 12px;
margin-left: -1px;
line-height: 1.42857143;
color: #337ab7;
text-decoration: none;
background-color: #fff;
border: 1px solid #ddd;
}
.pagination > li > a:hover,
.pagination > li > span:hover,
.pagination > li > a:focus,
.pagination > li > span:focus {
z-index: 2;
color: #23527c;
background-color: #eeeeee;
border-color: #ddd;
}
.pagination > li:first-child > a,
.pagination > li:first-child > span {
margin-left: 0;
border-top-left-radius: 4px;
border-bottom-left-radius: 4px;
}
.pagination > li:last-child > a,
.pagination > li:last-child > span {
border-top-right-radius: 4px;
border-bottom-right-radius: 4px;
}
.pagination > .active > a,
.pagination > .active > span,
.pagination > .active > a:hover,
.pagination > .active > span:hover,
.pagination > .active > a:focus,
.pagination > .active > span:focus {
z-index: 3;
color: #fff;
cursor: default;
background-color: #337ab7;
border-color: #337ab7;
}
.pagination > .disabled > span,
.pagination > .disabled > span:hover,
.pagination > .disabled > span:focus,
.pagination > .disabled > a,
.pagination > .disabled > a:hover,
.pagination > .disabled > a:focus {
color: #777777;
cursor: not-allowed;
background-color: #fff;
border-color: #ddd;
}
.pagination-lg > li > a,
.pagination-lg > li > span {
padding: 10px 16px;
font-size: 18px;
line-height: 1.3333333;
}
.pagination-lg > li:first-child > a,
.pagination-lg > li:first-child > span {
border-top-left-radius: 6px;
border-bottom-left-radius: 6px;
}
.pagination-lg > li:last-child > a,
.pagination-lg > li:last-child > span {
border-top-right-radius: 6px;
border-bottom-right-radius: 6px;
}
.pagination-sm > li > a,
.pagination-sm > li > span {
padding: 5px 10px;
font-size: 12px;
line-height: 1.5;
}
.pagination-sm > li:first-child > a,
.pagination-sm > li:first-child > span {
border-top-left-radius: 3px;
border-bottom-left-radius: 3px;
}
.pagination-sm > li:last-child > a,
.pagination-sm > li:last-child > span {
border-top-right-radius: 3px;
border-bottom-right-radius: 3px;
}
.pager {
padding-left: 0;
margin: 20px 0;
text-align: center;
list-style: none;
}
.pager li {
display: inline;
}
.pager li > a,
.pager li > span {
display: inline-block;
padding: 5px 14px;
background-color: #fff;
border: 1px solid #ddd;
border-radius: 15px;
}
.pager li > a:hover,
.pager li > a:focus {
text-decoration: none;
background-color: #eeeeee;
}
.pager .next > a,
.pager .next > span {
float: right;
}
.pager .previous > a,
.pager .previous > span {
float: left;
}
.pager .disabled > a,
.pager .disabled > a:hover,
.pager .disabled > a:focus,
.pager .disabled > span {
color: #777777;
cursor: not-allowed;
background-color: #fff;
}
.label {
display: inline;
padding: 0.2em 0.6em 0.3em;
font-size: 75%;
font-weight: 700;
line-height: 1;
color: #fff;
text-align: center;
white-space: nowrap;
vertical-align: baseline;
border-radius: 0.25em;
}
a.label:hover,
a.label:focus {
color: #fff;
text-decoration: none;
cursor: pointer;
}
.label:empty {
display: none;
}
.btn .label {
position: relative;
top: -1px;
}
.label-default {
background-color: #777777;
}
.label-default[href]:hover,
.label-default[href]:focus {
background-color: #5e5e5e;
}
.label-primary {
background-color: #337ab7;
}
.label-primary[href]:hover,
.label-primary[href]:focus {
background-color: #286090;
}
.label-success {
background-color: #5cb85c;
}
.label-success[href]:hover,
.label-success[href]:focus {
background-color: #449d44;
}
.label-info {
background-color: #5bc0de;
}
.label-info[href]:hover,
.label-info[href]:focus {
background-color: #31b0d5;
}
.label-warning {
background-color: #f0ad4e;
}
.label-warning[href]:hover,
.label-warning[href]:focus {
background-color: #ec971f;
}
.label-danger {
background-color: #d9534f;
}
.label-danger[href]:hover,
.label-danger[href]:focus {
background-color: #c9302c;
}
.badge {
display: inline-block;
min-width: 10px;
padding: 3px 7px;
font-size: 12px;
font-weight: bold;
line-height: 1;
color: #fff;
text-align: center;
white-space: nowrap;
vertical-align: middle;
background-color: #777777;
border-radius: 10px;
}
.badge:empty {
display: none;
}
.btn .badge {
position: relative;
top: -1px;
}
.btn-xs .badge,
.btn-group-xs > .btn .badge {
top: 0;
padding: 1px 5px;
}
a.badge:hover,
a.badge:focus {
color: #fff;
text-decoration: none;
cursor: pointer;
}
.list-group-item.active > .badge,
.nav-pills > .active > a > .badge {
color: #337ab7;
background-color: #fff;
}
.list-group-item > .badge {
float: right;
}
.list-group-item > .badge + .badge {
margin-right: 5px;
}
.nav-pills > li > a > .badge {
margin-left: 3px;
}
.jumbotron {
padding-top: 30px;
padding-bottom: 30px;
margin-bottom: 30px;
color: inherit;
background-color: #eeeeee;
}
.jumbotron h1,
.jumbotron .h1 {
color: inherit;
}
.jumbotron p {
margin-bottom: 15px;
font-size: 21px;
font-weight: 200;
}
.jumbotron > hr {
border-top-color: #d5d5d5;
}
.container .jumbotron,
.container-fluid .jumbotron {
padding-right: 15px;
padding-left: 15px;
border-radius: 6px;
}
.jumbotron .container {
max-width: 100%;
}
@media screen and (min-width: 768px) {
.jumbotron {
padding-top: 48px;
padding-bottom: 48px;
}
.container .jumbotron,
.container-fluid .jumbotron {
padding-right: 60px;
padding-left: 60px;
}
.jumbotron h1,
.jumbotron .h1 {
font-size: 63px;
}
}
.thumbnail {
display: block;
padding: 4px;
margin-bottom: 20px;
line-height: 1.42857143;
background-color: #fff;
border: 1px solid #ddd;
border-radius: 4px;
-webkit-transition: border 0.2s ease-in-out;
-o-transition: border 0.2s ease-in-out;
transition: border 0.2s ease-in-out;
}
.thumbnail > img,
.thumbnail a > img {
margin-right: auto;
margin-left: auto;
}
a.thumbnail:hover,
a.thumbnail:focus,
a.thumbnail.active {
border-color: #337ab7;
}
.thumbnail .caption {
padding: 9px;
color: #333333;
}
.alert {
padding: 15px;
margin-bottom: 20px;
border: 1px solid transparent;
border-radius: 4px;
}
.alert h4 {
margin-top: 0;
color: inherit;
}
.alert .alert-link {
font-weight: bold;
}
.alert > p,
.alert > ul {
margin-bottom: 0;
}
.alert > p + p {
margin-top: 5px;
}
.alert-dismissable,
.alert-dismissible {
padding-right: 35px;
}
.alert-dismissable .close,
.alert-dismissible .close {
position: relative;
top: -2px;
right: -21px;
color: inherit;
}
.alert-success {
color: #3c763d;
background-color: #dff0d8;
border-color: #d6e9c6;
}
.alert-success hr {
border-top-color: #c9e2b3;
}
.alert-success .alert-link {
color: #2b542c;
}
.alert-info {
color: #31708f;
background-color: #d9edf7;
border-color: #bce8f1;
}
.alert-info hr {
border-top-color: #a6e1ec;
}
.alert-info .alert-link {
color: #245269;
}
.alert-warning {
color: #8a6d3b;
background-color: #fcf8e3;
border-color: #faebcc;
}
.alert-warning hr {
border-top-color: #f7e1b5;
}
.alert-warning .alert-link {
color: #66512c;
}
.alert-danger {
color: #a94442;
background-color: #f2dede;
border-color: #ebccd1;
}
.alert-danger hr {
border-top-color: #e4b9c0;
}
.alert-danger .alert-link {
color: #843534;
}
@-webkit-keyframes progress-bar-stripes {
from {
background-position: 40px 0;
}
to {
background-position: 0 0;
}
}
@-o-keyframes progress-bar-stripes {
from {
background-position: 40px 0;
}
to {
background-position: 0 0;
}
}
@keyframes progress-bar-stripes {
from {
background-position: 40px 0;
}
to {
background-position: 0 0;
}
}
.progress {
height: 20px;
margin-bottom: 20px;
overflow: hidden;
background-color: #f5f5f5;
border-radius: 4px;
-webkit-box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1);
box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1);
}
.progress-bar {
float: left;
width: 0%;
height: 100%;
font-size: 12px;
line-height: 20px;
color: #fff;
text-align: center;
background-color: #337ab7;
-webkit-box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.15);
box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.15);
-webkit-transition: width 0.6s ease;
-o-transition: width 0.6s ease;
transition: width 0.6s ease;
}
.progress-striped .progress-bar,
.progress-bar-striped {
background-image: -webkit-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
background-image: -o-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
background-image: linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
-webkit-background-size: 40px 40px;
background-size: 40px 40px;
}
.progress.active .progress-bar,
.progress-bar.active {
-webkit-animation: progress-bar-stripes 2s linear infinite;
-o-animation: progress-bar-stripes 2s linear infinite;
animation: progress-bar-stripes 2s linear infinite;
}
.progress-bar-success {
background-color: #5cb85c;
}
.progress-striped .progress-bar-success {
background-image: -webkit-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
background-image: -o-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
background-image: linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
}
.progress-bar-info {
background-color: #5bc0de;
}
.progress-striped .progress-bar-info {
background-image: -webkit-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
background-image: -o-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
background-image: linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
}
.progress-bar-warning {
background-color: #f0ad4e;
}
.progress-striped .progress-bar-warning {
background-image: -webkit-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
background-image: -o-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
background-image: linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
}
.progress-bar-danger {
background-color: #d9534f;
}
.progress-striped .progress-bar-danger {
background-image: -webkit-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
background-image: -o-linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
background-image: linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
}
.media {
margin-top: 15px;
}
.media:first-child {
margin-top: 0;
}
.media,
.media-body {
overflow: hidden;
zoom: 1;
}
.media-body {
width: 10000px;
}
.media-object {
display: block;
}
.media-object.img-thumbnail {
max-width: none;
}
.media-right,
.media > .pull-right {
padding-left: 10px;
}
.media-left,
.media > .pull-left {
padding-right: 10px;
}
.media-left,
.media-right,
.media-body {
display: table-cell;
vertical-align: top;
}
.media-middle {
vertical-align: middle;
}
.media-bottom {
vertical-align: bottom;
}
.media-heading {
margin-top: 0;
margin-bottom: 5px;
}
.media-list {
padding-left: 0;
list-style: none;
}
.list-group {
padding-left: 0;
margin-bottom: 20px;
}
.list-group-item {
position: relative;
display: block;
padding: 10px 15px;
margin-bottom: -1px;
background-color: #fff;
border: 1px solid #ddd;
}
.list-group-item:first-child {
border-top-left-radius: 4px;
border-top-right-radius: 4px;
}
.list-group-item:last-child {
margin-bottom: 0;
border-bottom-right-radius: 4px;
border-bottom-left-radius: 4px;
}
.list-group-item.disabled,
.list-group-item.disabled:hover,
.list-group-item.disabled:focus {
color: #777777;
cursor: not-allowed;
background-color: #eeeeee;
}
.list-group-item.disabled .list-group-item-heading,
.list-group-item.disabled:hover .list-group-item-heading,
.list-group-item.disabled:focus .list-group-item-heading {
color: inherit;
}
.list-group-item.disabled .list-group-item-text,
.list-group-item.disabled:hover .list-group-item-text,
.list-group-item.disabled:focus .list-group-item-text {
color: #777777;
}
.list-group-item.active,
.list-group-item.active:hover,
.list-group-item.active:focus {
z-index: 2;
color: #fff;
background-color: #337ab7;
border-color: #337ab7;
}
.list-group-item.active .list-group-item-heading,
.list-group-item.active:hover .list-group-item-heading,
.list-group-item.active:focus .list-group-item-heading,
.list-group-item.active .list-group-item-heading > small,
.list-group-item.active:hover .list-group-item-heading > small,
.list-group-item.active:focus .list-group-item-heading > small,
.list-group-item.active .list-group-item-heading > .small,
.list-group-item.active:hover .list-group-item-heading > .small,
.list-group-item.active:focus .list-group-item-heading > .small {
color: inherit;
}
.list-group-item.active .list-group-item-text,
.list-group-item.active:hover .list-group-item-text,
.list-group-item.active:focus .list-group-item-text {
color: #c7ddef;
}
a.list-group-item,
button.list-group-item {
color: #555;
}
a.list-group-item .list-group-item-heading,
button.list-group-item .list-group-item-heading {
color: #333;
}
a.list-group-item:hover,
button.list-group-item:hover,
a.list-group-item:focus,
button.list-group-item:focus {
color: #555;
text-decoration: none;
background-color: #f5f5f5;
}
button.list-group-item {
width: 100%;
text-align: left;
}
.list-group-item-success {
color: #3c763d;
background-color: #dff0d8;
}
a.list-group-item-success,
button.list-group-item-success {
color: #3c763d;
}
a.list-group-item-success .list-group-item-heading,
button.list-group-item-success .list-group-item-heading {
color: inherit;
}
a.list-group-item-success:hover,
button.list-group-item-success:hover,
a.list-group-item-success:focus,
button.list-group-item-success:focus {
color: #3c763d;
background-color: #d0e9c6;
}
a.list-group-item-success.active,
button.list-group-item-success.active,
a.list-group-item-success.active:hover,
button.list-group-item-success.active:hover,
a.list-group-item-success.active:focus,
button.list-group-item-success.active:focus {
color: #fff;
background-color: #3c763d;
border-color: #3c763d;
}
.list-group-item-info {
color: #31708f;
background-color: #d9edf7;
}
a.list-group-item-info,
button.list-group-item-info {
color: #31708f;
}
a.list-group-item-info .list-group-item-heading,
button.list-group-item-info .list-group-item-heading {
color: inherit;
}
a.list-group-item-info:hover,
button.list-group-item-info:hover,
a.list-group-item-info:focus,
button.list-group-item-info:focus {
color: #31708f;
background-color: #c4e3f3;
}
a.list-group-item-info.active,
button.list-group-item-info.active,
a.list-group-item-info.active:hover,
button.list-group-item-info.active:hover,
a.list-group-item-info.active:focus,
button.list-group-item-info.active:focus {
color: #fff;
background-color: #31708f;
border-color: #31708f;
}
.list-group-item-warning {
color: #8a6d3b;
background-color: #fcf8e3;
}
a.list-group-item-warning,
button.list-group-item-warning {
color: #8a6d3b;
}
a.list-group-item-warning .list-group-item-heading,
button.list-group-item-warning .list-group-item-heading {
color: inherit;
}
a.list-group-item-warning:hover,
button.list-group-item-warning:hover,
a.list-group-item-warning:focus,
button.list-group-item-warning:focus {
color: #8a6d3b;
background-color: #faf2cc;
}
a.list-group-item-warning.active,
button.list-group-item-warning.active,
a.list-group-item-warning.active:hover,
button.list-group-item-warning.active:hover,
a.list-group-item-warning.active:focus,
button.list-group-item-warning.active:focus {
color: #fff;
background-color: #8a6d3b;
border-color: #8a6d3b;
}
.list-group-item-danger {
color: #a94442;
background-color: #f2dede;
}
a.list-group-item-danger,
button.list-group-item-danger {
color: #a94442;
}
a.list-group-item-danger .list-group-item-heading,
button.list-group-item-danger .list-group-item-heading {
color: inherit;
}
a.list-group-item-danger:hover,
button.list-group-item-danger:hover,
a.list-group-item-danger:focus,
button.list-group-item-danger:focus {
color: #a94442;
background-color: #ebcccc;
}
a.list-group-item-danger.active,
button.list-group-item-danger.active,
a.list-group-item-danger.active:hover,
button.list-group-item-danger.active:hover,
a.list-group-item-danger.active:focus,
button.list-group-item-danger.active:focus {
color: #fff;
background-color: #a94442;
border-color: #a94442;
}
.list-group-item-heading {
margin-top: 0;
margin-bottom: 5px;
}
.list-group-item-text {
margin-bottom: 0;
line-height: 1.3;
}
.panel {
margin-bottom: 20px;
background-color: #fff;
border: 1px solid transparent;
border-radius: 4px;
-webkit-box-shadow: 0 1px 1px rgba(0, 0, 0, 0.05);
box-shadow: 0 1px 1px rgba(0, 0, 0, 0.05);
}
.panel-body {
padding: 15px;
}
.panel-heading {
padding: 10px 15px;
border-bottom: 1px solid transparent;
border-top-left-radius: 3px;
border-top-right-radius: 3px;
}
.panel-heading > .dropdown .dropdown-toggle {
color: inherit;
}
.panel-title {
margin-top: 0;
margin-bottom: 0;
font-size: 16px;
color: inherit;
}
.panel-title > a,
.panel-title > small,
.panel-title > .small,
.panel-title > small > a,
.panel-title > .small > a {
color: inherit;
}
.panel-footer {
padding: 10px 15px;
background-color: #f5f5f5;
border-top: 1px solid #ddd;
border-bottom-right-radius: 3px;
border-bottom-left-radius: 3px;
}
.panel > .list-group,
.panel > .panel-collapse > .list-group {
margin-bottom: 0;
}
.panel > .list-group .list-group-item,
.panel > .panel-collapse > .list-group .list-group-item {
border-width: 1px 0;
border-radius: 0;
}
.panel > .list-group:first-child .list-group-item:first-child,
.panel > .panel-collapse > .list-group:first-child .list-group-item:first-child {
border-top: 0;
border-top-left-radius: 3px;
border-top-right-radius: 3px;
}
.panel > .list-group:last-child .list-group-item:last-child,
.panel > .panel-collapse > .list-group:last-child .list-group-item:last-child {
border-bottom: 0;
border-bottom-right-radius: 3px;
border-bottom-left-radius: 3px;
}
.panel > .panel-heading + .panel-collapse > .list-group .list-group-item:first-child {
border-top-left-radius: 0;
border-top-right-radius: 0;
}
.panel-heading + .list-group .list-group-item:first-child {
border-top-width: 0;
}
.list-group + .panel-footer {
border-top-width: 0;
}
.panel > .table,
.panel > .table-responsive > .table,
.panel > .panel-collapse > .table {
margin-bottom: 0;
}
.panel > .table caption,
.panel > .table-responsive > .table caption,
.panel > .panel-collapse > .table caption {
padding-right: 15px;
padding-left: 15px;
}
.panel > .table:first-child,
.panel > .table-responsive:first-child > .table:first-child {
border-top-left-radius: 3px;
border-top-right-radius: 3px;
}
.panel > .table:first-child > thead:first-child > tr:first-child,
.panel > .table-responsive:first-child > .table:first-child > thead:first-child > tr:first-child,
.panel > .table:first-child > tbody:first-child > tr:first-child,
.panel > .table-responsive:first-child > .table:first-child > tbody:first-child > tr:first-child {
border-top-left-radius: 3px;
border-top-right-radius: 3px;
}
.panel > .table:first-child > thead:first-child > tr:first-child td:first-child,
.panel > .table-responsive:first-child > .table:first-child > thead:first-child > tr:first-child td:first-child,
.panel > .table:first-child > tbody:first-child > tr:first-child td:first-child,
.panel > .table-responsive:first-child > .table:first-child > tbody:first-child > tr:first-child td:first-child,
.panel > .table:first-child > thead:first-child > tr:first-child th:first-child,
.panel > .table-responsive:first-child > .table:first-child > thead:first-child > tr:first-child th:first-child,
.panel > .table:first-child > tbody:first-child > tr:first-child th:first-child,
.panel > .table-responsive:first-child > .table:first-child > tbody:first-child > tr:first-child th:first-child {
border-top-left-radius: 3px;
}
.panel > .table:first-child > thead:first-child > tr:first-child td:last-child,
.panel > .table-responsive:first-child > .table:first-child > thead:first-child > tr:first-child td:last-child,
.panel > .table:first-child > tbody:first-child > tr:first-child td:last-child,
.panel > .table-responsive:first-child > .table:first-child > tbody:first-child > tr:first-child td:last-child,
.panel > .table:first-child > thead:first-child > tr:first-child th:last-child,
.panel > .table-responsive:first-child > .table:first-child > thead:first-child > tr:first-child th:last-child,
.panel > .table:first-child > tbody:first-child > tr:first-child th:last-child,
.panel > .table-responsive:first-child > .table:first-child > tbody:first-child > tr:first-child th:last-child {
border-top-right-radius: 3px;
}
.panel > .table:last-child,
.panel > .table-responsive:last-child > .table:last-child {
border-bottom-right-radius: 3px;
border-bottom-left-radius: 3px;
}
.panel > .table:last-child > tbody:last-child > tr:last-child,
.panel > .table-responsive:last-child > .table:last-child > tbody:last-child > tr:last-child,
.panel > .table:last-child > tfoot:last-child > tr:last-child,
.panel > .table-responsive:last-child > .table:last-child > tfoot:last-child > tr:last-child {
border-bottom-right-radius: 3px;
border-bottom-left-radius: 3px;
}
.panel > .table:last-child > tbody:last-child > tr:last-child td:first-child,
.panel > .table-responsive:last-child > .table:last-child > tbody:last-child > tr:last-child td:first-child,
.panel > .table:last-child > tfoot:last-child > tr:last-child td:first-child,
.panel > .table-responsive:last-child > .table:last-child > tfoot:last-child > tr:last-child td:first-child,
.panel > .table:last-child > tbody:last-child > tr:last-child th:first-child,
.panel > .table-responsive:last-child > .table:last-child > tbody:last-child > tr:last-child th:first-child,
.panel > .table:last-child > tfoot:last-child > tr:last-child th:first-child,
.panel > .table-responsive:last-child > .table:last-child > tfoot:last-child > tr:last-child th:first-child {
border-bottom-left-radius: 3px;
}
.panel > .table:last-child > tbody:last-child > tr:last-child td:last-child,
.panel > .table-responsive:last-child > .table:last-child > tbody:last-child > tr:last-child td:last-child,
.panel > .table:last-child > tfoot:last-child > tr:last-child td:last-child,
.panel > .table-responsive:last-child > .table:last-child > tfoot:last-child > tr:last-child td:last-child,
.panel > .table:last-child > tbody:last-child > tr:last-child th:last-child,
.panel > .table-responsive:last-child > .table:last-child > tbody:last-child > tr:last-child th:last-child,
.panel > .table:last-child > tfoot:last-child > tr:last-child th:last-child,
.panel > .table-responsive:last-child > .table:last-child > tfoot:last-child > tr:last-child th:last-child {
border-bottom-right-radius: 3px;
}
.panel > .panel-body + .table,
.panel > .panel-body + .table-responsive,
.panel > .table + .panel-body,
.panel > .table-responsive + .panel-body {
border-top: 1px solid #ddd;
}
.panel > .table > tbody:first-child > tr:first-child th,
.panel > .table > tbody:first-child > tr:first-child td {
border-top: 0;
}
.panel > .table-bordered,
.panel > .table-responsive > .table-bordered {
border: 0;
}
.panel > .table-bordered > thead > tr > th:first-child,
.panel > .table-responsive > .table-bordered > thead > tr > th:first-child,
.panel > .table-bordered > tbody > tr > th:first-child,
.panel > .table-responsive > .table-bordered > tbody > tr > th:first-child,
.panel > .table-bordered > tfoot > tr > th:first-child,
.panel > .table-responsive > .table-bordered > tfoot > tr > th:first-child,
.panel > .table-bordered > thead > tr > td:first-child,
.panel > .table-responsive > .table-bordered > thead > tr > td:first-child,
.panel > .table-bordered > tbody > tr > td:first-child,
.panel > .table-responsive > .table-bordered > tbody > tr > td:first-child,
.panel > .table-bordered > tfoot > tr > td:first-child,
.panel > .table-responsive > .table-bordered > tfoot > tr > td:first-child {
border-left: 0;
}
.panel > .table-bordered > thead > tr > th:last-child,
.panel > .table-responsive > .table-bordered > thead > tr > th:last-child,
.panel > .table-bordered > tbody > tr > th:last-child,
.panel > .table-responsive > .table-bordered > tbody > tr > th:last-child,
.panel > .table-bordered > tfoot > tr > th:last-child,
.panel > .table-responsive > .table-bordered > tfoot > tr > th:last-child,
.panel > .table-bordered > thead > tr > td:last-child,
.panel > .table-responsive > .table-bordered > thead > tr > td:last-child,
.panel > .table-bordered > tbody > tr > td:last-child,
.panel > .table-responsive > .table-bordered > tbody > tr > td:last-child,
.panel > .table-bordered > tfoot > tr > td:last-child,
.panel > .table-responsive > .table-bordered > tfoot > tr > td:last-child {
border-right: 0;
}
.panel > .table-bordered > thead > tr:first-child > td,
.panel > .table-responsive > .table-bordered > thead > tr:first-child > td,
.panel > .table-bordered > tbody > tr:first-child > td,
.panel > .table-responsive > .table-bordered > tbody > tr:first-child > td,
.panel > .table-bordered > thead > tr:first-child > th,
.panel > .table-responsive > .table-bordered > thead > tr:first-child > th,
.panel > .table-bordered > tbody > tr:first-child > th,
.panel > .table-responsive > .table-bordered > tbody > tr:first-child > th {
border-bottom: 0;
}
.panel > .table-bordered > tbody > tr:last-child > td,
.panel > .table-responsive > .table-bordered > tbody > tr:last-child > td,
.panel > .table-bordered > tfoot > tr:last-child > td,
.panel > .table-responsive > .table-bordered > tfoot > tr:last-child > td,
.panel > .table-bordered > tbody > tr:last-child > th,
.panel > .table-responsive > .table-bordered > tbody > tr:last-child > th,
.panel > .table-bordered > tfoot > tr:last-child > th,
.panel > .table-responsive > .table-bordered > tfoot > tr:last-child > th {
border-bottom: 0;
}
.panel > .table-responsive {
margin-bottom: 0;
border: 0;
}
.panel-group {
margin-bottom: 20px;
}
.panel-group .panel {
margin-bottom: 0;
border-radius: 4px;
}
.panel-group .panel + .panel {
margin-top: 5px;
}
.panel-group .panel-heading {
border-bottom: 0;
}
.panel-group .panel-heading + .panel-collapse > .panel-body,
.panel-group .panel-heading + .panel-collapse > .list-group {
border-top: 1px solid #ddd;
}
.panel-group .panel-footer {
border-top: 0;
}
.panel-group .panel-footer + .panel-collapse .panel-body {
border-bottom: 1px solid #ddd;
}
.panel-default {
border-color: #ddd;
}
.panel-default > .panel-heading {
color: #333333;
background-color: #f5f5f5;
border-color: #ddd;
}
.panel-default > .panel-heading + .panel-collapse > .panel-body {
border-top-color: #ddd;
}
.panel-default > .panel-heading .badge {
color: #f5f5f5;
background-color: #333333;
}
.panel-default > .panel-footer + .panel-collapse > .panel-body {
border-bottom-color: #ddd;
}
.panel-primary {
border-color: #337ab7;
}
.panel-primary > .panel-heading {
color: #fff;
background-color: #337ab7;
border-color: #337ab7;
}
.panel-primary > .panel-heading + .panel-collapse > .panel-body {
border-top-color: #337ab7;
}
.panel-primary > .panel-heading .badge {
color: #337ab7;
background-color: #fff;
}
.panel-primary > .panel-footer + .panel-collapse > .panel-body {
border-bottom-color: #337ab7;
}
.panel-success {
border-color: #d6e9c6;
}
.panel-success > .panel-heading {
color: #3c763d;
background-color: #dff0d8;
border-color: #d6e9c6;
}
.panel-success > .panel-heading + .panel-collapse > .panel-body {
border-top-color: #d6e9c6;
}
.panel-success > .panel-heading .badge {
color: #dff0d8;
background-color: #3c763d;
}
.panel-success > .panel-footer + .panel-collapse > .panel-body {
border-bottom-color: #d6e9c6;
}
.panel-info {
border-color: #bce8f1;
}
.panel-info > .panel-heading {
color: #31708f;
background-color: #d9edf7;
border-color: #bce8f1;
}
.panel-info > .panel-heading + .panel-collapse > .panel-body {
border-top-color: #bce8f1;
}
.panel-info > .panel-heading .badge {
color: #d9edf7;
background-color: #31708f;
}
.panel-info > .panel-footer + .panel-collapse > .panel-body {
border-bottom-color: #bce8f1;
}
.panel-warning {
border-color: #faebcc;
}
.panel-warning > .panel-heading {
color: #8a6d3b;
background-color: #fcf8e3;
border-color: #faebcc;
}
.panel-warning > .panel-heading + .panel-collapse > .panel-body {
border-top-color: #faebcc;
}
.panel-warning > .panel-heading .badge {
color: #fcf8e3;
background-color: #8a6d3b;
}
.panel-warning > .panel-footer + .panel-collapse > .panel-body {
border-bottom-color: #faebcc;
}
.panel-danger {
border-color: #ebccd1;
}
.panel-danger > .panel-heading {
color: #a94442;
background-color: #f2dede;
border-color: #ebccd1;
}
.panel-danger > .panel-heading + .panel-collapse > .panel-body {
border-top-color: #ebccd1;
}
.panel-danger > .panel-heading .badge {
color: #f2dede;
background-color: #a94442;
}
.panel-danger > .panel-footer + .panel-collapse > .panel-body {
border-bottom-color: #ebccd1;
}
.embed-responsive {
position: relative;
display: block;
height: 0;
padding: 0;
overflow: hidden;
}
.embed-responsive .embed-responsive-item,
.embed-responsive iframe,
.embed-responsive embed,
.embed-responsive object,
.embed-responsive video {
position: absolute;
top: 0;
bottom: 0;
left: 0;
width: 100%;
height: 100%;
border: 0;
}
.embed-responsive-16by9 {
padding-bottom: 56.25%;
}
.embed-responsive-4by3 {
padding-bottom: 75%;
}
.well {
min-height: 20px;
padding: 19px;
margin-bottom: 20px;
background-color: #f5f5f5;
border: 1px solid #e3e3e3;
border-radius: 4px;
-webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.05);
box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.05);
}
.well blockquote {
border-color: #ddd;
border-color: rgba(0, 0, 0, 0.15);
}
.well-lg {
padding: 24px;
border-radius: 6px;
}
.well-sm {
padding: 9px;
border-radius: 3px;
}
.close {
float: right;
font-size: 21px;
font-weight: bold;
line-height: 1;
color: #000;
text-shadow: 0 1px 0 #fff;
filter: alpha(opacity=20);
opacity: 0.2;
}
.close:hover,
.close:focus {
color: #000;
text-decoration: none;
cursor: pointer;
filter: alpha(opacity=50);
opacity: 0.5;
}
button.close {
padding: 0;
cursor: pointer;
background: transparent;
border: 0;
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
}
.modal-open {
overflow: hidden;
}
.modal {
position: fixed;
top: 0;
right: 0;
bottom: 0;
left: 0;
z-index: 1050;
display: none;
overflow: hidden;
-webkit-overflow-scrolling: touch;
outline: 0;
}
.modal.fade .modal-dialog {
-webkit-transform: translate(0, -25%);
-ms-transform: translate(0, -25%);
-o-transform: translate(0, -25%);
transform: translate(0, -25%);
-webkit-transition: -webkit-transform 0.3s ease-out;
-o-transition: -o-transform 0.3s ease-out;
transition: -webkit-transform 0.3s ease-out;
transition: transform 0.3s ease-out;
transition: transform 0.3s ease-out, -webkit-transform 0.3s ease-out, -o-transform 0.3s ease-out;
}
.modal.in .modal-dialog {
-webkit-transform: translate(0, 0);
-ms-transform: translate(0, 0);
-o-transform: translate(0, 0);
transform: translate(0, 0);
}
.modal-open .modal {
overflow-x: hidden;
overflow-y: auto;
}
.modal-dialog {
position: relative;
width: auto;
margin: 10px;
}
.modal-content {
position: relative;
background-color: #fff;
background-clip: padding-box;
border: 1px solid #999;
border: 1px solid rgba(0, 0, 0, 0.2);
border-radius: 6px;
-webkit-box-shadow: 0 3px 9px rgba(0, 0, 0, 0.5);
box-shadow: 0 3px 9px rgba(0, 0, 0, 0.5);
outline: 0;
}
.modal-backdrop {
position: fixed;
top: 0;
right: 0;
bottom: 0;
left: 0;
z-index: 1040;
background-color: #000;
}
.modal-backdrop.fade {
filter: alpha(opacity=0);
opacity: 0;
}
.modal-backdrop.in {
filter: alpha(opacity=50);
opacity: 0.5;
}
.modal-header {
padding: 15px;
border-bottom: 1px solid #e5e5e5;
}
.modal-header .close {
margin-top: -2px;
}
.modal-title {
margin: 0;
line-height: 1.42857143;
}
.modal-body {
position: relative;
padding: 15px;
}
.modal-footer {
padding: 15px;
text-align: right;
border-top: 1px solid #e5e5e5;
}
.modal-footer .btn + .btn {
margin-bottom: 0;
margin-left: 5px;
}
.modal-footer .btn-group .btn + .btn {
margin-left: -1px;
}
.modal-footer .btn-block + .btn-block {
margin-left: 0;
}
.modal-scrollbar-measure {
position: absolute;
top: -9999px;
width: 50px;
height: 50px;
overflow: scroll;
}
@media (min-width: 768px) {
.modal-dialog {
width: 600px;
margin: 30px auto;
}
.modal-content {
-webkit-box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5);
box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5);
}
.modal-sm {
width: 300px;
}
}
@media (min-width: 992px) {
.modal-lg {
width: 900px;
}
}
.tooltip {
position: absolute;
z-index: 1070;
display: block;
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
font-style: normal;
font-weight: 400;
line-height: 1.42857143;
line-break: auto;
text-align: left;
text-align: start;
text-decoration: none;
text-shadow: none;
text-transform: none;
letter-spacing: normal;
word-break: normal;
word-spacing: normal;
word-wrap: normal;
white-space: normal;
font-size: 12px;
filter: alpha(opacity=0);
opacity: 0;
}
.tooltip.in {
filter: alpha(opacity=90);
opacity: 0.9;
}
.tooltip.top {
padding: 5px 0;
margin-top: -3px;
}
.tooltip.right {
padding: 0 5px;
margin-left: 3px;
}
.tooltip.bottom {
padding: 5px 0;
margin-top: 3px;
}
.tooltip.left {
padding: 0 5px;
margin-left: -3px;
}
.tooltip.top .tooltip-arrow {
bottom: 0;
left: 50%;
margin-left: -5px;
border-width: 5px 5px 0;
border-top-color: #000;
}
.tooltip.top-left .tooltip-arrow {
right: 5px;
bottom: 0;
margin-bottom: -5px;
border-width: 5px 5px 0;
border-top-color: #000;
}
.tooltip.top-right .tooltip-arrow {
bottom: 0;
left: 5px;
margin-bottom: -5px;
border-width: 5px 5px 0;
border-top-color: #000;
}
.tooltip.right .tooltip-arrow {
top: 50%;
left: 0;
margin-top: -5px;
border-width: 5px 5px 5px 0;
border-right-color: #000;
}
.tooltip.left .tooltip-arrow {
top: 50%;
right: 0;
margin-top: -5px;
border-width: 5px 0 5px 5px;
border-left-color: #000;
}
.tooltip.bottom .tooltip-arrow {
top: 0;
left: 50%;
margin-left: -5px;
border-width: 0 5px 5px;
border-bottom-color: #000;
}
.tooltip.bottom-left .tooltip-arrow {
top: 0;
right: 5px;
margin-top: -5px;
border-width: 0 5px 5px;
border-bottom-color: #000;
}
.tooltip.bottom-right .tooltip-arrow {
top: 0;
left: 5px;
margin-top: -5px;
border-width: 0 5px 5px;
border-bottom-color: #000;
}
.tooltip-inner {
max-width: 200px;
padding: 3px 8px;
color: #fff;
text-align: center;
background-color: #000;
border-radius: 4px;
}
.tooltip-arrow {
position: absolute;
width: 0;
height: 0;
border-color: transparent;
border-style: solid;
}
.popover {
position: absolute;
top: 0;
left: 0;
z-index: 1060;
display: none;
max-width: 276px;
padding: 1px;
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
font-style: normal;
font-weight: 400;
line-height: 1.42857143;
line-break: auto;
text-align: left;
text-align: start;
text-decoration: none;
text-shadow: none;
text-transform: none;
letter-spacing: normal;
word-break: normal;
word-spacing: normal;
word-wrap: normal;
white-space: normal;
font-size: 14px;
background-color: #fff;
background-clip: padding-box;
border: 1px solid #ccc;
border: 1px solid rgba(0, 0, 0, 0.2);
border-radius: 6px;
-webkit-box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2);
box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2);
}
.popover.top {
margin-top: -10px;
}
.popover.right {
margin-left: 10px;
}
.popover.bottom {
margin-top: 10px;
}
.popover.left {
margin-left: -10px;
}
.popover > .arrow {
border-width: 11px;
}
.popover > .arrow,
.popover > .arrow:after {
position: absolute;
display: block;
width: 0;
height: 0;
border-color: transparent;
border-style: solid;
}
.popover > .arrow:after {
content: "";
border-width: 10px;
}
.popover.top > .arrow {
bottom: -11px;
left: 50%;
margin-left: -11px;
border-top-color: #999999;
border-top-color: rgba(0, 0, 0, 0.25);
border-bottom-width: 0;
}
.popover.top > .arrow:after {
bottom: 1px;
margin-left: -10px;
content: " ";
border-top-color: #fff;
border-bottom-width: 0;
}
.popover.right > .arrow {
top: 50%;
left: -11px;
margin-top: -11px;
border-right-color: #999999;
border-right-color: rgba(0, 0, 0, 0.25);
border-left-width: 0;
}
.popover.right > .arrow:after {
bottom: -10px;
left: 1px;
content: " ";
border-right-color: #fff;
border-left-width: 0;
}
.popover.bottom > .arrow {
top: -11px;
left: 50%;
margin-left: -11px;
border-top-width: 0;
border-bottom-color: #999999;
border-bottom-color: rgba(0, 0, 0, 0.25);
}
.popover.bottom > .arrow:after {
top: 1px;
margin-left: -10px;
content: " ";
border-top-width: 0;
border-bottom-color: #fff;
}
.popover.left > .arrow {
top: 50%;
right: -11px;
margin-top: -11px;
border-right-width: 0;
border-left-color: #999999;
border-left-color: rgba(0, 0, 0, 0.25);
}
.popover.left > .arrow:after {
right: 1px;
bottom: -10px;
content: " ";
border-right-width: 0;
border-left-color: #fff;
}
.popover-title {
padding: 8px 14px;
margin: 0;
font-size: 14px;
background-color: #f7f7f7;
border-bottom: 1px solid #ebebeb;
border-radius: 5px 5px 0 0;
}
.popover-content {
padding: 9px 14px;
}
.carousel {
position: relative;
}
.carousel-inner {
position: relative;
width: 100%;
overflow: hidden;
}
.carousel-inner > .item {
position: relative;
display: none;
-webkit-transition: 0.6s ease-in-out left;
-o-transition: 0.6s ease-in-out left;
transition: 0.6s ease-in-out left;
}
.carousel-inner > .item > img,
.carousel-inner > .item > a > img {
line-height: 1;
}
@media all and (transform-3d), (-webkit-transform-3d) {
.carousel-inner > .item {
-webkit-transition: -webkit-transform 0.6s ease-in-out;
-o-transition: -o-transform 0.6s ease-in-out;
transition: -webkit-transform 0.6s ease-in-out;
transition: transform 0.6s ease-in-out;
transition: transform 0.6s ease-in-out, -webkit-transform 0.6s ease-in-out, -o-transform 0.6s ease-in-out;
-webkit-backface-visibility: hidden;
backface-visibility: hidden;
-webkit-perspective: 1000px;
perspective: 1000px;
}
.carousel-inner > .item.next,
.carousel-inner > .item.active.right {
-webkit-transform: translate3d(100%, 0, 0);
transform: translate3d(100%, 0, 0);
left: 0;
}
.carousel-inner > .item.prev,
.carousel-inner > .item.active.left {
-webkit-transform: translate3d(-100%, 0, 0);
transform: translate3d(-100%, 0, 0);
left: 0;
}
.carousel-inner > .item.next.left,
.carousel-inner > .item.prev.right,
.carousel-inner > .item.active {
-webkit-transform: translate3d(0, 0, 0);
transform: translate3d(0, 0, 0);
left: 0;
}
}
.carousel-inner > .active,
.carousel-inner > .next,
.carousel-inner > .prev {
display: block;
}
.carousel-inner > .active {
left: 0;
}
.carousel-inner > .next,
.carousel-inner > .prev {
position: absolute;
top: 0;
width: 100%;
}
.carousel-inner > .next {
left: 100%;
}
.carousel-inner > .prev {
left: -100%;
}
.carousel-inner > .next.left,
.carousel-inner > .prev.right {
left: 0;
}
.carousel-inner > .active.left {
left: -100%;
}
.carousel-inner > .active.right {
left: 100%;
}
.carousel-control {
position: absolute;
top: 0;
bottom: 0;
left: 0;
width: 15%;
font-size: 20px;
color: #fff;
text-align: center;
text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
background-color: rgba(0, 0, 0, 0);
filter: alpha(opacity=50);
opacity: 0.5;
}
.carousel-control.left {
background-image: -webkit-linear-gradient(left, rgba(0, 0, 0, 0.5) 0%, rgba(0, 0, 0, 0.0001) 100%);
background-image: -o-linear-gradient(left, rgba(0, 0, 0, 0.5) 0%, rgba(0, 0, 0, 0.0001) 100%);
background-image: -webkit-gradient(linear, left top, right top, from(rgba(0, 0, 0, 0.5)), to(rgba(0, 0, 0, 0.0001)));
background-image: linear-gradient(to right, rgba(0, 0, 0, 0.5) 0%, rgba(0, 0, 0, 0.0001) 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#80000000', endColorstr='#00000000', GradientType=1);
background-repeat: repeat-x;
}
.carousel-control.right {
right: 0;
left: auto;
background-image: -webkit-linear-gradient(left, rgba(0, 0, 0, 0.0001) 0%, rgba(0, 0, 0, 0.5) 100%);
background-image: -o-linear-gradient(left, rgba(0, 0, 0, 0.0001) 0%, rgba(0, 0, 0, 0.5) 100%);
background-image: -webkit-gradient(linear, left top, right top, from(rgba(0, 0, 0, 0.0001)), to(rgba(0, 0, 0, 0.5)));
background-image: linear-gradient(to right, rgba(0, 0, 0, 0.0001) 0%, rgba(0, 0, 0, 0.5) 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#00000000', endColorstr='#80000000', GradientType=1);
background-repeat: repeat-x;
}
.carousel-control:hover,
.carousel-control:focus {
color: #fff;
text-decoration: none;
outline: 0;
filter: alpha(opacity=90);
opacity: 0.9;
}
.carousel-control .icon-prev,
.carousel-control .icon-next,
.carousel-control .glyphicon-chevron-left,
.carousel-control .glyphicon-chevron-right {
position: absolute;
top: 50%;
z-index: 5;
display: inline-block;
margin-top: -10px;
}
.carousel-control .icon-prev,
.carousel-control .glyphicon-chevron-left {
left: 50%;
margin-left: -10px;
}
.carousel-control .icon-next,
.carousel-control .glyphicon-chevron-right {
right: 50%;
margin-right: -10px;
}
.carousel-control .icon-prev,
.carousel-control .icon-next {
width: 20px;
height: 20px;
font-family: serif;
line-height: 1;
}
.carousel-control .icon-prev:before {
content: "\2039";
}
.carousel-control .icon-next:before {
content: "\203a";
}
.carousel-indicators {
position: absolute;
bottom: 10px;
left: 50%;
z-index: 15;
width: 60%;
padding-left: 0;
margin-left: -30%;
text-align: center;
list-style: none;
}
.carousel-indicators li {
display: inline-block;
width: 10px;
height: 10px;
margin: 1px;
text-indent: -999px;
cursor: pointer;
background-color: #000 \9;
background-color: rgba(0, 0, 0, 0);
border: 1px solid #fff;
border-radius: 10px;
}
.carousel-indicators .active {
width: 12px;
height: 12px;
margin: 0;
background-color: #fff;
}
.carousel-caption {
position: absolute;
right: 15%;
bottom: 20px;
left: 15%;
z-index: 10;
padding-top: 20px;
padding-bottom: 20px;
color: #fff;
text-align: center;
text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
}
.carousel-caption .btn {
text-shadow: none;
}
@media screen and (min-width: 768px) {
.carousel-control .glyphicon-chevron-left,
.carousel-control .glyphicon-chevron-right,
.carousel-control .icon-prev,
.carousel-control .icon-next {
width: 30px;
height: 30px;
margin-top: -10px;
font-size: 30px;
}
.carousel-control .glyphicon-chevron-left,
.carousel-control .icon-prev {
margin-left: -10px;
}
.carousel-control .glyphicon-chevron-right,
.carousel-control .icon-next {
margin-right: -10px;
}
.carousel-caption {
right: 20%;
left: 20%;
padding-bottom: 30px;
}
.carousel-indicators {
bottom: 20px;
}
}
.clearfix:before,
.clearfix:after,
.dl-horizontal dd:before,
.dl-horizontal dd:after,
.container:before,
.container:after,
.container-fluid:before,
.container-fluid:after,
.row:before,
.row:after,
.form-horizontal .form-group:before,
.form-horizontal .form-group:after,
.btn-toolbar:before,
.btn-toolbar:after,
.btn-group-vertical > .btn-group:before,
.btn-group-vertical > .btn-group:after,
.nav:before,
.nav:after,
.navbar:before,
.navbar:after,
.navbar-header:before,
.navbar-header:after,
.navbar-collapse:before,
.navbar-collapse:after,
.pager:before,
.pager:after,
.panel-body:before,
.panel-body:after,
.modal-header:before,
.modal-header:after,
.modal-footer:before,
.modal-footer:after {
display: table;
content: " ";
}
.clearfix:after,
.dl-horizontal dd:after,
.container:after,
.container-fluid:after,
.row:after,
.form-horizontal .form-group:after,
.btn-toolbar:after,
.btn-group-vertical > .btn-group:after,
.nav:after,
.navbar:after,
.navbar-header:after,
.navbar-collapse:after,
.pager:after,
.panel-body:after,
.modal-header:after,
.modal-footer:after {
clear: both;
}
.center-block {
display: block;
margin-right: auto;
margin-left: auto;
}
.pull-right {
float: right !important;
}
.pull-left {
float: left !important;
}
.hide {
display: none !important;
}
.show {
display: block !important;
}
.invisible {
visibility: hidden;
}
.text-hide {
font: 0/0 a;
color: transparent;
text-shadow: none;
background-color: transparent;
border: 0;
}
.hidden {
display: none !important;
}
.affix {
position: fixed;
}
@-ms-viewport {
width: device-width;
}
.visible-xs,
.visible-sm,
.visible-md,
.visible-lg {
display: none !important;
}
.visible-xs-block,
.visible-xs-inline,
.visible-xs-inline-block,
.visible-sm-block,
.visible-sm-inline,
.visible-sm-inline-block,
.visible-md-block,
.visible-md-inline,
.visible-md-inline-block,
.visible-lg-block,
.visible-lg-inline,
.visible-lg-inline-block {
display: none !important;
}
@media (max-width: 767px) {
.visible-xs {
display: block !important;
}
table.visible-xs {
display: table !important;
}
tr.visible-xs {
display: table-row !important;
}
th.visible-xs,
td.visible-xs {
display: table-cell !important;
}
}
@media (max-width: 767px) {
.visible-xs-block {
display: block !important;
}
}
@media (max-width: 767px) {
.visible-xs-inline {
display: inline !important;
}
}
@media (max-width: 767px) {
.visible-xs-inline-block {
display: inline-block !important;
}
}
@media (min-width: 768px) and (max-width: 991px) {
.visible-sm {
display: block !important;
}
table.visible-sm {
display: table !important;
}
tr.visible-sm {
display: table-row !important;
}
th.visible-sm,
td.visible-sm {
display: table-cell !important;
}
}
@media (min-width: 768px) and (max-width: 991px) {
.visible-sm-block {
display: block !important;
}
}
@media (min-width: 768px) and (max-width: 991px) {
.visible-sm-inline {
display: inline !important;
}
}
@media (min-width: 768px) and (max-width: 991px) {
.visible-sm-inline-block {
display: inline-block !important;
}
}
@media (min-width: 992px) and (max-width: 1199px) {
.visible-md {
display: block !important;
}
table.visible-md {
display: table !important;
}
tr.visible-md {
display: table-row !important;
}
th.visible-md,
td.visible-md {
display: table-cell !important;
}
}
@media (min-width: 992px) and (max-width: 1199px) {
.visible-md-block {
display: block !important;
}
}
@media (min-width: 992px) and (max-width: 1199px) {
.visible-md-inline {
display: inline !important;
}
}
@media (min-width: 992px) and (max-width: 1199px) {
.visible-md-inline-block {
display: inline-block !important;
}
}
@media (min-width: 1200px) {
.visible-lg {
display: block !important;
}
table.visible-lg {
display: table !important;
}
tr.visible-lg {
display: table-row !important;
}
th.visible-lg,
td.visible-lg {
display: table-cell !important;
}
}
@media (min-width: 1200px) {
.visible-lg-block {
display: block !important;
}
}
@media (min-width: 1200px) {
.visible-lg-inline {
display: inline !important;
}
}
@media (min-width: 1200px) {
.visible-lg-inline-block {
display: inline-block !important;
}
}
@media (max-width: 767px) {
.hidden-xs {
display: none !important;
}
}
@media (min-width: 768px) and (max-width: 991px) {
.hidden-sm {
display: none !important;
}
}
@media (min-width: 992px) and (max-width: 1199px) {
.hidden-md {
display: none !important;
}
}
@media (min-width: 1200px) {
.hidden-lg {
display: none !important;
}
}
.visible-print {
display: none !important;
}
@media print {
.visible-print {
display: block !important;
}
table.visible-print {
display: table !important;
}
tr.visible-print {
display: table-row !important;
}
th.visible-print,
td.visible-print {
display: table-cell !important;
}
}
.visible-print-block {
display: none !important;
}
@media print {
.visible-print-block {
display: block !important;
}
}
.visible-print-inline {
display: none !important;
}
@media print {
.visible-print-inline {
display: inline !important;
}
}
.visible-print-inline-block {
display: none !important;
}
@media print {
.visible-print-inline-block {
display: inline-block !important;
}
}
@media print {
.hidden-print {
display: none !important;
}
}
/*# sourceMappingURL=bootstrap.css.map */
================================================
FILE: pyscada/hmi/static/pyscada/css/daterangepicker/daterangepicker.css
================================================
.daterangepicker {
position: absolute;
color: inherit;
background-color: #fff;
border-radius: 4px;
border: 1px solid #ddd;
width: 278px;
max-width: none;
padding: 0;
margin-top: 7px;
top: 100px;
left: 20px;
z-index: 3001;
display: none;
font-family: arial;
font-size: 15px;
line-height: 1em;
}
.daterangepicker:before, .daterangepicker:after {
position: absolute;
display: inline-block;
border-bottom-color: rgba(0, 0, 0, 0.2);
content: '';
}
.daterangepicker:before {
top: -7px;
border-right: 7px solid transparent;
border-left: 7px solid transparent;
border-bottom: 7px solid #ccc;
}
.daterangepicker:after {
top: -6px;
border-right: 6px solid transparent;
border-bottom: 6px solid #fff;
border-left: 6px solid transparent;
}
.daterangepicker.opensleft:before {
right: 9px;
}
.daterangepicker.opensleft:after {
right: 10px;
}
.daterangepicker.openscenter:before {
left: 0;
right: 0;
width: 0;
margin-left: auto;
margin-right: auto;
}
.daterangepicker.openscenter:after {
left: 0;
right: 0;
width: 0;
margin-left: auto;
margin-right: auto;
}
.daterangepicker.opensright:before {
left: 9px;
}
.daterangepicker.opensright:after {
left: 10px;
}
.daterangepicker.drop-up {
margin-top: -7px;
}
.daterangepicker.drop-up:before {
top: initial;
bottom: -7px;
border-bottom: initial;
border-top: 7px solid #ccc;
}
.daterangepicker.drop-up:after {
top: initial;
bottom: -6px;
border-bottom: initial;
border-top: 6px solid #fff;
}
.daterangepicker.single .daterangepicker .ranges, .daterangepicker.single .drp-calendar {
float: none;
}
.daterangepicker.single .drp-selected {
display: none;
}
.daterangepicker.show-calendar .drp-calendar {
display: block;
}
.daterangepicker.show-calendar .drp-buttons {
display: block;
}
.daterangepicker.auto-apply .drp-buttons {
display: none;
}
.daterangepicker .drp-calendar {
display: none;
max-width: 270px;
}
.daterangepicker .drp-calendar.left {
padding: 8px 0 8px 8px;
}
.daterangepicker .drp-calendar.right {
padding: 8px;
}
.daterangepicker .drp-calendar.single .calendar-table {
border: none;
}
.daterangepicker .calendar-table .next span, .daterangepicker .calendar-table .prev span {
color: #fff;
border: solid black;
border-width: 0 2px 2px 0;
border-radius: 0;
display: inline-block;
padding: 3px;
}
.daterangepicker .calendar-table .next span {
transform: rotate(-45deg);
-webkit-transform: rotate(-45deg);
}
.daterangepicker .calendar-table .prev span {
transform: rotate(135deg);
-webkit-transform: rotate(135deg);
}
.daterangepicker .calendar-table th, .daterangepicker .calendar-table td {
white-space: nowrap;
text-align: center;
vertical-align: middle;
min-width: 32px;
width: 32px;
height: 24px;
line-height: 24px;
font-size: 12px;
border-radius: 4px;
border: 1px solid transparent;
white-space: nowrap;
cursor: pointer;
}
.daterangepicker .calendar-table {
border: 1px solid #fff;
border-radius: 4px;
background-color: #fff;
}
.daterangepicker .calendar-table table {
width: 100%;
margin: 0;
border-spacing: 0;
border-collapse: collapse;
}
.daterangepicker td.available:hover, .daterangepicker th.available:hover {
background-color: #eee;
border-color: transparent;
color: inherit;
}
.daterangepicker td.week, .daterangepicker th.week {
font-size: 80%;
color: #ccc;
}
.daterangepicker td.off, .daterangepicker td.off.in-range, .daterangepicker td.off.start-date, .daterangepicker td.off.end-date {
background-color: #fff;
border-color: transparent;
color: #999;
}
.daterangepicker td.in-range {
background-color: #ebf4f8;
border-color: transparent;
color: #000;
border-radius: 0;
}
.daterangepicker td.start-date {
border-radius: 4px 0 0 4px;
}
.daterangepicker td.end-date {
border-radius: 0 4px 4px 0;
}
.daterangepicker td.start-date.end-date {
border-radius: 4px;
}
.daterangepicker td.active, .daterangepicker td.active:hover {
background-color: #357ebd;
border-color: transparent;
color: #fff;
}
.daterangepicker th.month {
width: auto;
}
.daterangepicker td.disabled, .daterangepicker option.disabled {
color: #999;
cursor: not-allowed;
text-decoration: line-through;
}
.daterangepicker select.monthselect, .daterangepicker select.yearselect {
font-size: 12px;
padding: 1px;
height: auto;
margin: 0;
cursor: default;
}
.daterangepicker select.monthselect {
margin-right: 2%;
width: 56%;
}
.daterangepicker select.yearselect {
width: 40%;
}
.daterangepicker select.hourselect, .daterangepicker select.minuteselect, .daterangepicker select.secondselect, .daterangepicker select.ampmselect {
width: 50px;
margin: 0 auto;
background: #eee;
border: 1px solid #eee;
padding: 2px;
outline: 0;
font-size: 12px;
}
.daterangepicker .calendar-time {
text-align: center;
margin: 4px auto 0 auto;
line-height: 30px;
position: relative;
}
.daterangepicker .calendar-time select.disabled {
color: #ccc;
cursor: not-allowed;
}
.daterangepicker .drp-buttons {
clear: both;
text-align: right;
padding: 8px;
border-top: 1px solid #ddd;
display: none;
line-height: 12px;
vertical-align: middle;
}
.daterangepicker .drp-selected {
display: inline-block;
font-size: 12px;
padding-right: 8px;
}
.daterangepicker .drp-buttons .btn {
margin-left: 8px;
font-size: 12px;
font-weight: bold;
padding: 4px 8px;
}
.daterangepicker.show-ranges.single.rtl .drp-calendar.left {
border-right: 1px solid #ddd;
}
.daterangepicker.show-ranges.single.ltr .drp-calendar.left {
border-left: 1px solid #ddd;
}
.daterangepicker.show-ranges.rtl .drp-calendar.right {
border-right: 1px solid #ddd;
}
.daterangepicker.show-ranges.ltr .drp-calendar.left {
border-left: 1px solid #ddd;
}
.daterangepicker .ranges {
float: none;
text-align: left;
margin: 0;
}
.daterangepicker.show-calendar .ranges {
margin-top: 8px;
}
.daterangepicker .ranges ul {
list-style: none;
margin: 0 auto;
padding: 0;
width: 100%;
}
.daterangepicker .ranges li {
font-size: 12px;
padding: 8px 12px;
cursor: pointer;
}
.daterangepicker .ranges li:hover {
background-color: #eee;
}
.daterangepicker .ranges li.active {
background-color: #08c;
color: #fff;
}
/* Larger Screen Styling */
@media (min-width: 564px) {
.daterangepicker {
width: auto;
}
.daterangepicker .ranges ul {
width: 140px;
}
.daterangepicker.single .ranges ul {
width: 100%;
}
.daterangepicker.single .drp-calendar.left {
clear: none;
}
.daterangepicker.single .ranges, .daterangepicker.single .drp-calendar {
float: left;
}
.daterangepicker {
direction: ltr;
text-align: left;
}
.daterangepicker .drp-calendar.left {
clear: left;
margin-right: 0;
}
.daterangepicker .drp-calendar.left .calendar-table {
border-right: none;
border-top-right-radius: 0;
border-bottom-right-radius: 0;
}
.daterangepicker .drp-calendar.right {
margin-left: 0;
}
.daterangepicker .drp-calendar.right .calendar-table {
border-left: none;
border-top-left-radius: 0;
border-bottom-left-radius: 0;
}
.daterangepicker .drp-calendar.left .calendar-table {
padding-right: 8px;
}
.daterangepicker .ranges, .daterangepicker .drp-calendar {
float: left;
}
}
@media (min-width: 730px) {
.daterangepicker .ranges {
width: auto;
}
.daterangepicker .ranges {
float: left;
}
.daterangepicker.rtl .ranges {
float: right;
}
.daterangepicker .drp-calendar.left {
clear: none !important;
}
}
================================================
FILE: pyscada/hmi/static/pyscada/css/fonts/roboto/LICENSE.txt
================================================
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
================================================
FILE: pyscada/hmi/static/pyscada/css/jquery-ui/AUTHORS.txt
================================================
Authors ordered by first contribution
A list of current team members is available at http://jqueryui.com/about
Paul Bakaus
Richard Worth
Yehuda Katz
Sean Catchpole
John Resig
Tane Piper
Dmitri Gaskin
Klaus Hartl
Stefan Petre
Gilles van den Hoven
Micheil Bryan Smith
Jörn Zaefferer
Marc Grabanski
Keith Wood
Brandon Aaron
Scott González
Eduardo Lundgren
Aaron Eisenberger
Joan Piedra
Bruno Basto
Remy Sharp
Bohdan Ganicky
David Bolter
Chi Cheng
Ca-Phun Ung
Ariel Flesler
Maggie Wachs
Scott Jehl
Todd Parker
Andrew Powell
Brant Burnett
Douglas Neiner
Paul Irish
Ralph Whitbeck
Thibault Duplessis
Dominique Vincent
Jack Hsu
Adam Sontag
Carl Fürstenberg
Kevin Dalman
Alberto Fernández Capel
Jacek Jędrzejewski (http://jacek.jedrzejewski.name)
Ting Kuei
Samuel Cormier-Iijima
Jon Palmer
Ben Hollis
Justin MacCarthy
Eyal Kobrigo
Tiago Freire
Diego Tres
Holger Rüprich
Ziling Zhao
Mike Alsup
Robson Braga Araujo
Pierre-Henri Ausseil
Christopher McCulloh
Andrew Newcomb
Lim Chee Aun
Jorge Barreiro
Daniel Steigerwald
John Firebaugh
John Enters
Andrey Kapitcyn
Dmitry Petrov
Eric Hynds
Chairat Sunthornwiphat
Josh Varner
Stéphane Raimbault
Jay Merrifield
J. Ryan Stinnett
Peter Heiberg
Alex Dovenmuehle
Jamie Gegerson
Raymond Schwartz
Phillip Barnes
Kyle Wilkinson
Khaled AlHourani
Marian Rudzynski
Jean-Francois Remy
Doug Blood
Filippo Cavallarin
Heiko Henning
Aliaksandr Rahalevich
Mario Visic
Xavi Ramirez
Max Schnur
Saji Nediyanchath
Corey Frang
Aaron Peterson
Ivan Peters
Mohamed Cherif Bouchelaghem
Marcos Sousa
Michael DellaNoce
George Marshall
Tobias Brunner
Martin Solli
David Petersen
Dan Heberden
William Kevin Manire
Gilmore Davidson
Michael Wu
Adam Parod
Guillaume Gautreau
Marcel Toele
Dan Streetman
Matt Hoskins
Giovanni Giacobbi
Kyle Florence
Pavol Hluchý
Hans Hillen
Mark Johnson
Trey Hunner
Shane Whittet
Edward A Faulkner
Adam Baratz
Kato Kazuyoshi
Eike Send
Kris Borchers
Eddie Monge
Israel Tsadok
Carson McDonald
Jason Davies
Garrison Locke
David Murdoch
Benjamin Scott Boyle
Jesse Baird
Jonathan Vingiano
Dylan Just
Hiroshi Tomita
Glenn Goodrich
Tarafder Ashek-E-Elahi
Ryan Neufeld
Marc Neuwirth
Philip Graham
Benjamin Sterling
Wesley Walser
Kouhei Sutou
Karl Kirch
Chris Kelly
Jason Oster
Felix Nagel
Alexander Polomoshnov
David Leal
Igor Milla
Dave Methvin
Florian Gutmann
Marwan Al Jubeh
Milan Broum
Sebastian Sauer
Gaëtan Muller
Michel Weimerskirch
William Griffiths
Stojce Slavkovski
David Soms
David De Sloovere
Michael P. Jung
Shannon Pekary
Dan Wellman
Matthew Edward Hutton
James Khoury
Rob Loach
Alberto Monteiro
Alex Rhea
Krzysztof Rosiński
Ryan Olton
Genie <386@mail.com>
Rick Waldron
Ian Simpson
Lev Kitsis
TJ VanToll
Justin Domnitz
Douglas Cerna
Bert ter Heide
Jasvir Nagra
Yuriy Khabarov <13real008@gmail.com>
Harri Kilpiö
Lado Lomidze
Amir E. Aharoni
Simon Sattes
Jo Liss
Guntupalli Karunakar
Shahyar Ghobadpour
Lukasz Lipinski
Timo Tijhof
Jason Moon
Martin Frost
Eneko Illarramendi
EungJun Yi
Courtland Allen
Viktar Varvanovich
Danny Trunk
Pavel Stetina
Michael Stay
Steven Roussey
Michael Hollis
Lee Rowlands
Timmy Willison
Karl Swedberg
Baoju Yuan
Maciej Mroziński