Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 8d28435965 | |||
| e10445c21a | |||
| 606cd400a0 | |||
| 02217be44e |
118
detector/detector.py
Normal file
@ -0,0 +1,118 @@
|
|||||||
|
import cv2
|
||||||
|
|
||||||
|
class BaseDetector:
|
||||||
|
# интервал между заменой кадров при определении движения
|
||||||
|
FRAME_PERSIST = 3
|
||||||
|
STATUS_PERSIST = 6
|
||||||
|
# пороговое значение размера контура движущегося объекта
|
||||||
|
CONTOUR_TRESHOLD = 10
|
||||||
|
# сохраненный кадр для сравнения
|
||||||
|
frame_check = []
|
||||||
|
status_list = []
|
||||||
|
|
||||||
|
# вывод дополнительной информации
|
||||||
|
calibration = 1
|
||||||
|
|
||||||
|
def __init__(self, path, top, bottom, left, right):
|
||||||
|
self.path = path
|
||||||
|
self.top = top
|
||||||
|
self.bottom = bottom
|
||||||
|
self.left = left
|
||||||
|
self.right = right
|
||||||
|
|
||||||
|
def find_contours(self, img):
|
||||||
|
blur = cv2.GaussianBlur(img, (5, 5), 0)
|
||||||
|
_, thresh = cv2.threshold(blur, 20, 255, cv2.THRESH_BINARY)
|
||||||
|
dilated = cv2.dilate(thresh, None, iterations=3)
|
||||||
|
contours, _ = cv2.findContours(dilated, cv2.RETR_TREE,
|
||||||
|
cv2.CHAIN_APPROX_SIMPLE)
|
||||||
|
return contours
|
||||||
|
|
||||||
|
|
||||||
|
def contour_treshold(self, contours):
|
||||||
|
for contour in contours:
|
||||||
|
contourArea = cv2.contourArea(contour)
|
||||||
|
if contourArea < self.CONTOUR_TRESHOLD:
|
||||||
|
return True, None
|
||||||
|
return False, None
|
||||||
|
|
||||||
|
|
||||||
|
def contour_treshold_info(self, contours) -> tuple([bool, dict]):
|
||||||
|
max_contour, min_contour = 0, 10**5
|
||||||
|
sum_contour = 0
|
||||||
|
max_contour_array = []
|
||||||
|
contours_tr = []
|
||||||
|
for contour in contours:
|
||||||
|
contourArea = cv2.contourArea(contour)
|
||||||
|
sum_contour += contourArea
|
||||||
|
if contourArea > max_contour:
|
||||||
|
max_contour = contourArea
|
||||||
|
max_contour_array = contour
|
||||||
|
if contourArea < min_contour:
|
||||||
|
min_contour = contourArea
|
||||||
|
if contourArea > self.CONTOUR_TRESHOLD:
|
||||||
|
contours_tr.append(contour)
|
||||||
|
info = {'max_contour': max_contour,
|
||||||
|
'min_contour': min_contour,
|
||||||
|
'average': sum_contour / max(1, len(contours))}
|
||||||
|
return (max_contour > self.CONTOUR_TRESHOLD), info
|
||||||
|
|
||||||
|
|
||||||
|
def find_moving_object(self, img):
|
||||||
|
"""
|
||||||
|
Сравнивает новый кадр с кадром сохраненным ранее
|
||||||
|
возвращает координаты прямоугольных контуров движущихся объектов
|
||||||
|
"""
|
||||||
|
img = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
|
||||||
|
self.frame_check.append(img)
|
||||||
|
|
||||||
|
if len(self.frame_check)>self.FRAME_PERSIST:
|
||||||
|
self.frame_check.pop(0)
|
||||||
|
|
||||||
|
diff = cv2.absdiff(self.frame_check[0], img)
|
||||||
|
contours = self.find_contours(diff)
|
||||||
|
return (self.contour_treshold_info(contours) if self.calibration
|
||||||
|
else self.contour_treshold(contours))
|
||||||
|
|
||||||
|
def draw(self):
|
||||||
|
self.frame = cv2.rectangle(self.frame, (self.left, self.top), (self.frame.shape[1] - self.right, self.frame.shape[0] - self.bottom),
|
||||||
|
(255,0,0), 3)
|
||||||
|
color = (0, 255, 0) if self.status else (0, 0, 255)
|
||||||
|
self.frame = cv2.rectangle(self.frame, (self.left, self.top), (self.frame.shape[1] - self.right, self.frame.shape[0] - self.bottom),
|
||||||
|
color, 3)
|
||||||
|
|
||||||
|
def show(self):
|
||||||
|
cv2.imshow('test', self.frame)
|
||||||
|
cv2.waitKey(1)
|
||||||
|
|
||||||
|
def run(self):
|
||||||
|
self.cam = cv2.VideoCapture(self.path)
|
||||||
|
frame_width = int(self.cam.get(3))
|
||||||
|
frame_height = int(self.cam.get(4))
|
||||||
|
size = (frame_width, frame_height)
|
||||||
|
while True:
|
||||||
|
frame_exists, self.frame = self.cam.read()
|
||||||
|
if not frame_exists:
|
||||||
|
break
|
||||||
|
self.frame_margins = self.frame[self.top: self.frame.shape[0] - self.bottom,
|
||||||
|
self.left: self.frame.shape[1] - self.right]
|
||||||
|
self.moving_detected, self.info_moving = self.find_moving_object(self.frame_margins)
|
||||||
|
self.status_list.append(self.moving_detected)
|
||||||
|
if len(self.status_list)>self.STATUS_PERSIST:
|
||||||
|
self.status_list.pop(0)
|
||||||
|
self.status = (sum(self.status_list)/len(self.status_list))>0.5
|
||||||
|
print(self.status, self.info_moving)
|
||||||
|
result.write(self.frame)
|
||||||
|
result.release()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
path = ""
|
||||||
|
#0 top=150, bottom=300, left=900, right=150
|
||||||
|
#1 top=450, bottom=100, left=50, right=800
|
||||||
|
#2 top=150, bottom=200, left=520, right=0
|
||||||
|
#3 top=100, bottom=100, left=20, right=20
|
||||||
|
#4 top=0, bottom=250, left=950, right=0
|
||||||
|
detector1 = BaseDetector(path, top=150, bottom=200, left=520, right=0)
|
||||||
|
detector1.run()
|
||||||
@ -1,6 +1,16 @@
|
|||||||
version: '3.8'
|
version: '3.8'
|
||||||
|
|
||||||
services:
|
services:
|
||||||
|
mediamtx:
|
||||||
|
image: bluenviron/mediamtx:latest
|
||||||
|
container_name: mediamtx
|
||||||
|
restart: unless-stopped
|
||||||
|
ports:
|
||||||
|
- "8554:8554" # RTSP
|
||||||
|
- "8888:8888" # HLS
|
||||||
|
- "8889:8889" # WebRTC
|
||||||
|
- "9997:9997" # HTTP API
|
||||||
|
volumes:
|
||||||
|
- ./video_repeater/mediamtx.yml:/mediamtx.yml:ro
|
||||||
db:
|
db:
|
||||||
image: postgres:15
|
image: postgres:15
|
||||||
env_file:
|
env_file:
|
||||||
@ -9,7 +19,7 @@ services:
|
|||||||
- postgres_data:/var/lib/postgresql/data
|
- postgres_data:/var/lib/postgresql/data
|
||||||
|
|
||||||
web:
|
web:
|
||||||
build: ./service/zircon_web
|
build: ./web
|
||||||
ports:
|
ports:
|
||||||
- "8000:8000"
|
- "8000:8000"
|
||||||
depends_on:
|
depends_on:
|
||||||
@ -17,6 +27,6 @@ services:
|
|||||||
env_file:
|
env_file:
|
||||||
- web.env
|
- web.env
|
||||||
command: ["python", "manage.py", "runserver", "0.0.0.0:8000"]
|
command: ["python", "manage.py", "runserver", "0.0.0.0:8000"]
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
postgres_data:
|
postgres_data:
|
||||||
|
|||||||
@ -1 +0,0 @@
|
|||||||
# в данном каталоге содержатся инструменты для управления докером
|
|
||||||
@ -1,247 +0,0 @@
|
|||||||
<#
|
|
||||||
.Synopsis
|
|
||||||
Activate a Python virtual environment for the current PowerShell session.
|
|
||||||
|
|
||||||
.Description
|
|
||||||
Pushes the python executable for a virtual environment to the front of the
|
|
||||||
$Env:PATH environment variable and sets the prompt to signify that you are
|
|
||||||
in a Python virtual environment. Makes use of the command line switches as
|
|
||||||
well as the `pyvenv.cfg` file values present in the virtual environment.
|
|
||||||
|
|
||||||
.Parameter VenvDir
|
|
||||||
Path to the directory that contains the virtual environment to activate. The
|
|
||||||
default value for this is the parent of the directory that the Activate.ps1
|
|
||||||
script is located within.
|
|
||||||
|
|
||||||
.Parameter Prompt
|
|
||||||
The prompt prefix to display when this virtual environment is activated. By
|
|
||||||
default, this prompt is the name of the virtual environment folder (VenvDir)
|
|
||||||
surrounded by parentheses and followed by a single space (ie. '(.venv) ').
|
|
||||||
|
|
||||||
.Example
|
|
||||||
Activate.ps1
|
|
||||||
Activates the Python virtual environment that contains the Activate.ps1 script.
|
|
||||||
|
|
||||||
.Example
|
|
||||||
Activate.ps1 -Verbose
|
|
||||||
Activates the Python virtual environment that contains the Activate.ps1 script,
|
|
||||||
and shows extra information about the activation as it executes.
|
|
||||||
|
|
||||||
.Example
|
|
||||||
Activate.ps1 -VenvDir C:\Users\MyUser\Common\.venv
|
|
||||||
Activates the Python virtual environment located in the specified location.
|
|
||||||
|
|
||||||
.Example
|
|
||||||
Activate.ps1 -Prompt "MyPython"
|
|
||||||
Activates the Python virtual environment that contains the Activate.ps1 script,
|
|
||||||
and prefixes the current prompt with the specified string (surrounded in
|
|
||||||
parentheses) while the virtual environment is active.
|
|
||||||
|
|
||||||
.Notes
|
|
||||||
On Windows, it may be required to enable this Activate.ps1 script by setting the
|
|
||||||
execution policy for the user. You can do this by issuing the following PowerShell
|
|
||||||
command:
|
|
||||||
|
|
||||||
PS C:\> Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
|
|
||||||
|
|
||||||
For more information on Execution Policies:
|
|
||||||
https://go.microsoft.com/fwlink/?LinkID=135170
|
|
||||||
|
|
||||||
#>
|
|
||||||
Param(
|
|
||||||
[Parameter(Mandatory = $false)]
|
|
||||||
[String]
|
|
||||||
$VenvDir,
|
|
||||||
[Parameter(Mandatory = $false)]
|
|
||||||
[String]
|
|
||||||
$Prompt
|
|
||||||
)
|
|
||||||
|
|
||||||
<# Function declarations --------------------------------------------------- #>
|
|
||||||
|
|
||||||
<#
|
|
||||||
.Synopsis
|
|
||||||
Remove all shell session elements added by the Activate script, including the
|
|
||||||
addition of the virtual environment's Python executable from the beginning of
|
|
||||||
the PATH variable.
|
|
||||||
|
|
||||||
.Parameter NonDestructive
|
|
||||||
If present, do not remove this function from the global namespace for the
|
|
||||||
session.
|
|
||||||
|
|
||||||
#>
|
|
||||||
function global:deactivate ([switch]$NonDestructive) {
|
|
||||||
# Revert to original values
|
|
||||||
|
|
||||||
# The prior prompt:
|
|
||||||
if (Test-Path -Path Function:_OLD_VIRTUAL_PROMPT) {
|
|
||||||
Copy-Item -Path Function:_OLD_VIRTUAL_PROMPT -Destination Function:prompt
|
|
||||||
Remove-Item -Path Function:_OLD_VIRTUAL_PROMPT
|
|
||||||
}
|
|
||||||
|
|
||||||
# The prior PYTHONHOME:
|
|
||||||
if (Test-Path -Path Env:_OLD_VIRTUAL_PYTHONHOME) {
|
|
||||||
Copy-Item -Path Env:_OLD_VIRTUAL_PYTHONHOME -Destination Env:PYTHONHOME
|
|
||||||
Remove-Item -Path Env:_OLD_VIRTUAL_PYTHONHOME
|
|
||||||
}
|
|
||||||
|
|
||||||
# The prior PATH:
|
|
||||||
if (Test-Path -Path Env:_OLD_VIRTUAL_PATH) {
|
|
||||||
Copy-Item -Path Env:_OLD_VIRTUAL_PATH -Destination Env:PATH
|
|
||||||
Remove-Item -Path Env:_OLD_VIRTUAL_PATH
|
|
||||||
}
|
|
||||||
|
|
||||||
# Just remove the VIRTUAL_ENV altogether:
|
|
||||||
if (Test-Path -Path Env:VIRTUAL_ENV) {
|
|
||||||
Remove-Item -Path env:VIRTUAL_ENV
|
|
||||||
}
|
|
||||||
|
|
||||||
# Just remove VIRTUAL_ENV_PROMPT altogether.
|
|
||||||
if (Test-Path -Path Env:VIRTUAL_ENV_PROMPT) {
|
|
||||||
Remove-Item -Path env:VIRTUAL_ENV_PROMPT
|
|
||||||
}
|
|
||||||
|
|
||||||
# Just remove the _PYTHON_VENV_PROMPT_PREFIX altogether:
|
|
||||||
if (Get-Variable -Name "_PYTHON_VENV_PROMPT_PREFIX" -ErrorAction SilentlyContinue) {
|
|
||||||
Remove-Variable -Name _PYTHON_VENV_PROMPT_PREFIX -Scope Global -Force
|
|
||||||
}
|
|
||||||
|
|
||||||
# Leave deactivate function in the global namespace if requested:
|
|
||||||
if (-not $NonDestructive) {
|
|
||||||
Remove-Item -Path function:deactivate
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
<#
|
|
||||||
.Description
|
|
||||||
Get-PyVenvConfig parses the values from the pyvenv.cfg file located in the
|
|
||||||
given folder, and returns them in a map.
|
|
||||||
|
|
||||||
For each line in the pyvenv.cfg file, if that line can be parsed into exactly
|
|
||||||
two strings separated by `=` (with any amount of whitespace surrounding the =)
|
|
||||||
then it is considered a `key = value` line. The left hand string is the key,
|
|
||||||
the right hand is the value.
|
|
||||||
|
|
||||||
If the value starts with a `'` or a `"` then the first and last character is
|
|
||||||
stripped from the value before being captured.
|
|
||||||
|
|
||||||
.Parameter ConfigDir
|
|
||||||
Path to the directory that contains the `pyvenv.cfg` file.
|
|
||||||
#>
|
|
||||||
function Get-PyVenvConfig(
|
|
||||||
[String]
|
|
||||||
$ConfigDir
|
|
||||||
) {
|
|
||||||
Write-Verbose "Given ConfigDir=$ConfigDir, obtain values in pyvenv.cfg"
|
|
||||||
|
|
||||||
# Ensure the file exists, and issue a warning if it doesn't (but still allow the function to continue).
|
|
||||||
$pyvenvConfigPath = Join-Path -Resolve -Path $ConfigDir -ChildPath 'pyvenv.cfg' -ErrorAction Continue
|
|
||||||
|
|
||||||
# An empty map will be returned if no config file is found.
|
|
||||||
$pyvenvConfig = @{ }
|
|
||||||
|
|
||||||
if ($pyvenvConfigPath) {
|
|
||||||
|
|
||||||
Write-Verbose "File exists, parse `key = value` lines"
|
|
||||||
$pyvenvConfigContent = Get-Content -Path $pyvenvConfigPath
|
|
||||||
|
|
||||||
$pyvenvConfigContent | ForEach-Object {
|
|
||||||
$keyval = $PSItem -split "\s*=\s*", 2
|
|
||||||
if ($keyval[0] -and $keyval[1]) {
|
|
||||||
$val = $keyval[1]
|
|
||||||
|
|
||||||
# Remove extraneous quotations around a string value.
|
|
||||||
if ("'""".Contains($val.Substring(0, 1))) {
|
|
||||||
$val = $val.Substring(1, $val.Length - 2)
|
|
||||||
}
|
|
||||||
|
|
||||||
$pyvenvConfig[$keyval[0]] = $val
|
|
||||||
Write-Verbose "Adding Key: '$($keyval[0])'='$val'"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return $pyvenvConfig
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
<# Begin Activate script --------------------------------------------------- #>
|
|
||||||
|
|
||||||
# Determine the containing directory of this script
|
|
||||||
$VenvExecPath = Split-Path -Parent $MyInvocation.MyCommand.Definition
|
|
||||||
$VenvExecDir = Get-Item -Path $VenvExecPath
|
|
||||||
|
|
||||||
Write-Verbose "Activation script is located in path: '$VenvExecPath'"
|
|
||||||
Write-Verbose "VenvExecDir Fullname: '$($VenvExecDir.FullName)"
|
|
||||||
Write-Verbose "VenvExecDir Name: '$($VenvExecDir.Name)"
|
|
||||||
|
|
||||||
# Set values required in priority: CmdLine, ConfigFile, Default
|
|
||||||
# First, get the location of the virtual environment, it might not be
|
|
||||||
# VenvExecDir if specified on the command line.
|
|
||||||
if ($VenvDir) {
|
|
||||||
Write-Verbose "VenvDir given as parameter, using '$VenvDir' to determine values"
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
Write-Verbose "VenvDir not given as a parameter, using parent directory name as VenvDir."
|
|
||||||
$VenvDir = $VenvExecDir.Parent.FullName.TrimEnd("\\/")
|
|
||||||
Write-Verbose "VenvDir=$VenvDir"
|
|
||||||
}
|
|
||||||
|
|
||||||
# Next, read the `pyvenv.cfg` file to determine any required value such
|
|
||||||
# as `prompt`.
|
|
||||||
$pyvenvCfg = Get-PyVenvConfig -ConfigDir $VenvDir
|
|
||||||
|
|
||||||
# Next, set the prompt from the command line, or the config file, or
|
|
||||||
# just use the name of the virtual environment folder.
|
|
||||||
if ($Prompt) {
|
|
||||||
Write-Verbose "Prompt specified as argument, using '$Prompt'"
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
Write-Verbose "Prompt not specified as argument to script, checking pyvenv.cfg value"
|
|
||||||
if ($pyvenvCfg -and $pyvenvCfg['prompt']) {
|
|
||||||
Write-Verbose " Setting based on value in pyvenv.cfg='$($pyvenvCfg['prompt'])'"
|
|
||||||
$Prompt = $pyvenvCfg['prompt'];
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
Write-Verbose " Setting prompt based on parent's directory's name. (Is the directory name passed to venv module when creating the virtual environment)"
|
|
||||||
Write-Verbose " Got leaf-name of $VenvDir='$(Split-Path -Path $venvDir -Leaf)'"
|
|
||||||
$Prompt = Split-Path -Path $venvDir -Leaf
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Write-Verbose "Prompt = '$Prompt'"
|
|
||||||
Write-Verbose "VenvDir='$VenvDir'"
|
|
||||||
|
|
||||||
# Deactivate any currently active virtual environment, but leave the
|
|
||||||
# deactivate function in place.
|
|
||||||
deactivate -nondestructive
|
|
||||||
|
|
||||||
# Now set the environment variable VIRTUAL_ENV, used by many tools to determine
|
|
||||||
# that there is an activated venv.
|
|
||||||
$env:VIRTUAL_ENV = $VenvDir
|
|
||||||
|
|
||||||
if (-not $Env:VIRTUAL_ENV_DISABLE_PROMPT) {
|
|
||||||
|
|
||||||
Write-Verbose "Setting prompt to '$Prompt'"
|
|
||||||
|
|
||||||
# Set the prompt to include the env name
|
|
||||||
# Make sure _OLD_VIRTUAL_PROMPT is global
|
|
||||||
function global:_OLD_VIRTUAL_PROMPT { "" }
|
|
||||||
Copy-Item -Path function:prompt -Destination function:_OLD_VIRTUAL_PROMPT
|
|
||||||
New-Variable -Name _PYTHON_VENV_PROMPT_PREFIX -Description "Python virtual environment prompt prefix" -Scope Global -Option ReadOnly -Visibility Public -Value $Prompt
|
|
||||||
|
|
||||||
function global:prompt {
|
|
||||||
Write-Host -NoNewline -ForegroundColor Green "($_PYTHON_VENV_PROMPT_PREFIX) "
|
|
||||||
_OLD_VIRTUAL_PROMPT
|
|
||||||
}
|
|
||||||
$env:VIRTUAL_ENV_PROMPT = $Prompt
|
|
||||||
}
|
|
||||||
|
|
||||||
# Clear PYTHONHOME
|
|
||||||
if (Test-Path -Path Env:PYTHONHOME) {
|
|
||||||
Copy-Item -Path Env:PYTHONHOME -Destination Env:_OLD_VIRTUAL_PYTHONHOME
|
|
||||||
Remove-Item -Path Env:PYTHONHOME
|
|
||||||
}
|
|
||||||
|
|
||||||
# Add the venv to the PATH
|
|
||||||
Copy-Item -Path Env:PATH -Destination Env:_OLD_VIRTUAL_PATH
|
|
||||||
$Env:PATH = "$VenvExecDir$([System.IO.Path]::PathSeparator)$Env:PATH"
|
|
||||||
@ -1,70 +0,0 @@
|
|||||||
# This file must be used with "source bin/activate" *from bash*
|
|
||||||
# You cannot run it directly
|
|
||||||
|
|
||||||
deactivate () {
|
|
||||||
# reset old environment variables
|
|
||||||
if [ -n "${_OLD_VIRTUAL_PATH:-}" ] ; then
|
|
||||||
PATH="${_OLD_VIRTUAL_PATH:-}"
|
|
||||||
export PATH
|
|
||||||
unset _OLD_VIRTUAL_PATH
|
|
||||||
fi
|
|
||||||
if [ -n "${_OLD_VIRTUAL_PYTHONHOME:-}" ] ; then
|
|
||||||
PYTHONHOME="${_OLD_VIRTUAL_PYTHONHOME:-}"
|
|
||||||
export PYTHONHOME
|
|
||||||
unset _OLD_VIRTUAL_PYTHONHOME
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Call hash to forget past commands. Without forgetting
|
|
||||||
# past commands the $PATH changes we made may not be respected
|
|
||||||
hash -r 2> /dev/null
|
|
||||||
|
|
||||||
if [ -n "${_OLD_VIRTUAL_PS1:-}" ] ; then
|
|
||||||
PS1="${_OLD_VIRTUAL_PS1:-}"
|
|
||||||
export PS1
|
|
||||||
unset _OLD_VIRTUAL_PS1
|
|
||||||
fi
|
|
||||||
|
|
||||||
unset VIRTUAL_ENV
|
|
||||||
unset VIRTUAL_ENV_PROMPT
|
|
||||||
if [ ! "${1:-}" = "nondestructive" ] ; then
|
|
||||||
# Self destruct!
|
|
||||||
unset -f deactivate
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
# unset irrelevant variables
|
|
||||||
deactivate nondestructive
|
|
||||||
|
|
||||||
# on Windows, a path can contain colons and backslashes and has to be converted:
|
|
||||||
if [ "${OSTYPE:-}" = "cygwin" ] || [ "${OSTYPE:-}" = "msys" ] ; then
|
|
||||||
# transform D:\path\to\venv to /d/path/to/venv on MSYS
|
|
||||||
# and to /cygdrive/d/path/to/venv on Cygwin
|
|
||||||
export VIRTUAL_ENV=$(cygpath /home/efim/project/zircon/docker/python_docker_libs)
|
|
||||||
else
|
|
||||||
# use the path as-is
|
|
||||||
export VIRTUAL_ENV=/home/efim/project/zircon/docker/python_docker_libs
|
|
||||||
fi
|
|
||||||
|
|
||||||
_OLD_VIRTUAL_PATH="$PATH"
|
|
||||||
PATH="$VIRTUAL_ENV/"bin":$PATH"
|
|
||||||
export PATH
|
|
||||||
|
|
||||||
# unset PYTHONHOME if set
|
|
||||||
# this will fail if PYTHONHOME is set to the empty string (which is bad anyway)
|
|
||||||
# could use `if (set -u; : $PYTHONHOME) ;` in bash
|
|
||||||
if [ -n "${PYTHONHOME:-}" ] ; then
|
|
||||||
_OLD_VIRTUAL_PYTHONHOME="${PYTHONHOME:-}"
|
|
||||||
unset PYTHONHOME
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -z "${VIRTUAL_ENV_DISABLE_PROMPT:-}" ] ; then
|
|
||||||
_OLD_VIRTUAL_PS1="${PS1:-}"
|
|
||||||
PS1='(python_docker_libs) '"${PS1:-}"
|
|
||||||
export PS1
|
|
||||||
VIRTUAL_ENV_PROMPT='(python_docker_libs) '
|
|
||||||
export VIRTUAL_ENV_PROMPT
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Call hash to forget past commands. Without forgetting
|
|
||||||
# past commands the $PATH changes we made may not be respected
|
|
||||||
hash -r 2> /dev/null
|
|
||||||
@ -1,27 +0,0 @@
|
|||||||
# This file must be used with "source bin/activate.csh" *from csh*.
|
|
||||||
# You cannot run it directly.
|
|
||||||
|
|
||||||
# Created by Davide Di Blasi <davidedb@gmail.com>.
|
|
||||||
# Ported to Python 3.3 venv by Andrew Svetlov <andrew.svetlov@gmail.com>
|
|
||||||
|
|
||||||
alias deactivate 'test $?_OLD_VIRTUAL_PATH != 0 && setenv PATH "$_OLD_VIRTUAL_PATH" && unset _OLD_VIRTUAL_PATH; rehash; test $?_OLD_VIRTUAL_PROMPT != 0 && set prompt="$_OLD_VIRTUAL_PROMPT" && unset _OLD_VIRTUAL_PROMPT; unsetenv VIRTUAL_ENV; unsetenv VIRTUAL_ENV_PROMPT; test "\!:*" != "nondestructive" && unalias deactivate'
|
|
||||||
|
|
||||||
# Unset irrelevant variables.
|
|
||||||
deactivate nondestructive
|
|
||||||
|
|
||||||
setenv VIRTUAL_ENV /home/efim/project/zircon/docker/python_docker_libs
|
|
||||||
|
|
||||||
set _OLD_VIRTUAL_PATH="$PATH"
|
|
||||||
setenv PATH "$VIRTUAL_ENV/"bin":$PATH"
|
|
||||||
|
|
||||||
|
|
||||||
set _OLD_VIRTUAL_PROMPT="$prompt"
|
|
||||||
|
|
||||||
if (! "$?VIRTUAL_ENV_DISABLE_PROMPT") then
|
|
||||||
set prompt = '(python_docker_libs) '"$prompt"
|
|
||||||
setenv VIRTUAL_ENV_PROMPT '(python_docker_libs) '
|
|
||||||
endif
|
|
||||||
|
|
||||||
alias pydoc python -m pydoc
|
|
||||||
|
|
||||||
rehash
|
|
||||||
@ -1,69 +0,0 @@
|
|||||||
# This file must be used with "source <venv>/bin/activate.fish" *from fish*
|
|
||||||
# (https://fishshell.com/). You cannot run it directly.
|
|
||||||
|
|
||||||
function deactivate -d "Exit virtual environment and return to normal shell environment"
|
|
||||||
# reset old environment variables
|
|
||||||
if test -n "$_OLD_VIRTUAL_PATH"
|
|
||||||
set -gx PATH $_OLD_VIRTUAL_PATH
|
|
||||||
set -e _OLD_VIRTUAL_PATH
|
|
||||||
end
|
|
||||||
if test -n "$_OLD_VIRTUAL_PYTHONHOME"
|
|
||||||
set -gx PYTHONHOME $_OLD_VIRTUAL_PYTHONHOME
|
|
||||||
set -e _OLD_VIRTUAL_PYTHONHOME
|
|
||||||
end
|
|
||||||
|
|
||||||
if test -n "$_OLD_FISH_PROMPT_OVERRIDE"
|
|
||||||
set -e _OLD_FISH_PROMPT_OVERRIDE
|
|
||||||
# prevents error when using nested fish instances (Issue #93858)
|
|
||||||
if functions -q _old_fish_prompt
|
|
||||||
functions -e fish_prompt
|
|
||||||
functions -c _old_fish_prompt fish_prompt
|
|
||||||
functions -e _old_fish_prompt
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
set -e VIRTUAL_ENV
|
|
||||||
set -e VIRTUAL_ENV_PROMPT
|
|
||||||
if test "$argv[1]" != "nondestructive"
|
|
||||||
# Self-destruct!
|
|
||||||
functions -e deactivate
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
# Unset irrelevant variables.
|
|
||||||
deactivate nondestructive
|
|
||||||
|
|
||||||
set -gx VIRTUAL_ENV /home/efim/project/zircon/docker/python_docker_libs
|
|
||||||
|
|
||||||
set -gx _OLD_VIRTUAL_PATH $PATH
|
|
||||||
set -gx PATH "$VIRTUAL_ENV/"bin $PATH
|
|
||||||
|
|
||||||
# Unset PYTHONHOME if set.
|
|
||||||
if set -q PYTHONHOME
|
|
||||||
set -gx _OLD_VIRTUAL_PYTHONHOME $PYTHONHOME
|
|
||||||
set -e PYTHONHOME
|
|
||||||
end
|
|
||||||
|
|
||||||
if test -z "$VIRTUAL_ENV_DISABLE_PROMPT"
|
|
||||||
# fish uses a function instead of an env var to generate the prompt.
|
|
||||||
|
|
||||||
# Save the current fish_prompt function as the function _old_fish_prompt.
|
|
||||||
functions -c fish_prompt _old_fish_prompt
|
|
||||||
|
|
||||||
# With the original prompt function renamed, we can override with our own.
|
|
||||||
function fish_prompt
|
|
||||||
# Save the return status of the last command.
|
|
||||||
set -l old_status $status
|
|
||||||
|
|
||||||
# Output the venv prompt; color taken from the blue of the Python logo.
|
|
||||||
printf "%s%s%s" (set_color 4B8BBE) '(python_docker_libs) ' (set_color normal)
|
|
||||||
|
|
||||||
# Restore the return status of the previous command.
|
|
||||||
echo "exit $old_status" | .
|
|
||||||
# Output the original/"old" prompt.
|
|
||||||
_old_fish_prompt
|
|
||||||
end
|
|
||||||
|
|
||||||
set -gx _OLD_FISH_PROMPT_OVERRIDE "$VIRTUAL_ENV"
|
|
||||||
set -gx VIRTUAL_ENV_PROMPT '(python_docker_libs) '
|
|
||||||
end
|
|
||||||
@ -1,8 +0,0 @@
|
|||||||
#!/home/efim/project/zircon/docker/python_docker_libs/bin/python3
|
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
import re
|
|
||||||
import sys
|
|
||||||
from charset_normalizer import cli
|
|
||||||
if __name__ == '__main__':
|
|
||||||
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
|
||||||
sys.exit(cli.cli_detect())
|
|
||||||
@ -1,8 +0,0 @@
|
|||||||
#!/home/efim/project/zircon/docker/python_docker_libs/bin/python3
|
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
import re
|
|
||||||
import sys
|
|
||||||
from pip._internal.cli.main import main
|
|
||||||
if __name__ == '__main__':
|
|
||||||
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
|
||||||
sys.exit(main())
|
|
||||||
@ -1,8 +0,0 @@
|
|||||||
#!/home/efim/project/zircon/docker/python_docker_libs/bin/python3
|
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
import re
|
|
||||||
import sys
|
|
||||||
from pip._internal.cli.main import main
|
|
||||||
if __name__ == '__main__':
|
|
||||||
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
|
||||||
sys.exit(main())
|
|
||||||
@ -1,8 +0,0 @@
|
|||||||
#!/home/efim/project/zircon/docker/python_docker_libs/bin/python3
|
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
import re
|
|
||||||
import sys
|
|
||||||
from pip._internal.cli.main import main
|
|
||||||
if __name__ == '__main__':
|
|
||||||
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
|
||||||
sys.exit(main())
|
|
||||||
@ -1 +0,0 @@
|
|||||||
python3
|
|
||||||
@ -1 +0,0 @@
|
|||||||
/usr/bin/python3
|
|
||||||
@ -1 +0,0 @@
|
|||||||
python3
|
|
||||||
@ -1 +0,0 @@
|
|||||||
lib
|
|
||||||
@ -1,5 +0,0 @@
|
|||||||
home = /usr/bin
|
|
||||||
include-system-site-packages = false
|
|
||||||
version = 3.12.3
|
|
||||||
executable = /usr/bin/python3.12
|
|
||||||
command = /home/efim/project/zircon/docker/python_docker_libs/bin/python3 -m venv /home/efim/project/zircon/docker/python_docker_libs
|
|
||||||
@ -1,47 +0,0 @@
|
|||||||
import os
|
|
||||||
from io import BytesIO
|
|
||||||
import docker
|
|
||||||
|
|
||||||
def get_path(service_folder):
|
|
||||||
parent_dir = os.path.abspath(os.path.join(os.getcwd(), os.pardir))
|
|
||||||
service_dir = os.path.join(parent_dir, service_folder)
|
|
||||||
if not os.path.exists(service_dir):
|
|
||||||
raise FileNotFoundError(f"Папка 'service_dir' не существует.")
|
|
||||||
return service_dir
|
|
||||||
|
|
||||||
def get_requirements_service(service_folder):
|
|
||||||
# Рекурсивно сканируем все подпапки в папке service
|
|
||||||
requirements_service = []
|
|
||||||
for root, dirs, files in os.walk(service_folder):
|
|
||||||
if 'requirements.txt' in files:
|
|
||||||
root_service, service_name = root.split('/')[-2:]
|
|
||||||
requirements_path = os.path.join(root, 'requirements.txt')
|
|
||||||
requirements_service.append({'root_service':root_service,
|
|
||||||
'service_name':service_name,
|
|
||||||
'requirements_path':requirements_path,
|
|
||||||
'root':root})
|
|
||||||
return requirements_service
|
|
||||||
|
|
||||||
def build_requirements_image(requirements_path, container_name, root):
|
|
||||||
client = docker.from_env()
|
|
||||||
with open('./template/requirements.dockerfile', 'r', encoding='utf-8') as file:
|
|
||||||
docker_template = file.read()
|
|
||||||
docker_images = docker_template.format(requirements_path)
|
|
||||||
dockerfile = BytesIO(docker_images.encode('utf-8'))
|
|
||||||
print(requirements_path)
|
|
||||||
print(root)
|
|
||||||
image, logs = client.images.build(fileobj=dockerfile, tag='my_dynamic_app:latest', path=root)
|
|
||||||
return image, logs
|
|
||||||
|
|
||||||
|
|
||||||
if __name__=='__main__':
|
|
||||||
path_folder = get_path('service')
|
|
||||||
requirements_service = get_requirements_service(path_folder)
|
|
||||||
for service in requirements_service:
|
|
||||||
image, logs = build_requirements_image(service['requirements_path'],
|
|
||||||
f'requirements_{service['root_service']}_{service['service_name']}',
|
|
||||||
service['root'] )
|
|
||||||
|
|
||||||
for log in logs:
|
|
||||||
print(log.get('stream', ''))
|
|
||||||
print(f'Образ {image.tags[0]} успешно создан.')
|
|
||||||
@ -1,6 +0,0 @@
|
|||||||
FROM python:3.9-slim
|
|
||||||
|
|
||||||
COPY {} $APP_HOME
|
|
||||||
|
|
||||||
RUN pip wheel --no-cache-dir --no-deps --wheel-dir /wheels -r requirements.txt
|
|
||||||
RUN pip install --no-cache /wheels/* && rm -rf /wheels
|
|
||||||
@ -1,201 +0,0 @@
|
|||||||
import cv2
|
|
||||||
import os
|
|
||||||
import time
|
|
||||||
import requests
|
|
||||||
from line_profiler import profile
|
|
||||||
|
|
||||||
class BaseDetector:
|
|
||||||
# интервал между заменой кадров при определении движения
|
|
||||||
FRAME_PERSIST = 3
|
|
||||||
# пороговое значение размера контура движущегося объекта
|
|
||||||
CONTOUR_TRESHOLD = 10000
|
|
||||||
# сохраненный кадр для сравнения
|
|
||||||
frame_check = None
|
|
||||||
check_num = 0
|
|
||||||
# вывод дополнительной информации
|
|
||||||
calibration = 0
|
|
||||||
|
|
||||||
@profile
|
|
||||||
def find_contours(self, img):
|
|
||||||
blur = cv2.GaussianBlur(img, (5, 5), 0)
|
|
||||||
_, thresh = cv2.threshold(blur, 20, 255, cv2.THRESH_BINARY)
|
|
||||||
dilated = cv2.dilate(thresh, None, iterations=3)
|
|
||||||
contours, _ = cv2.findContours(dilated, cv2.RETR_TREE,
|
|
||||||
cv2.CHAIN_APPROX_SIMPLE)
|
|
||||||
return contours
|
|
||||||
|
|
||||||
@profile
|
|
||||||
def contour_treshold(self, contours):
|
|
||||||
for contour in contours:
|
|
||||||
contourArea = cv2.contourArea(contour)
|
|
||||||
if contourArea < self.CONTOUR_TRESHOLD:
|
|
||||||
return True, None
|
|
||||||
return False, None
|
|
||||||
|
|
||||||
@profile
|
|
||||||
def contour_treshold_info(self, contours) -> tuple([bool, dict]):
|
|
||||||
max_contour, min_contour = 0, 10**5
|
|
||||||
sum_contour = 0
|
|
||||||
max_contour_array = []
|
|
||||||
contours_tr = []
|
|
||||||
for contour in contours:
|
|
||||||
contourArea = cv2.contourArea(contour)
|
|
||||||
sum_contour += contourArea
|
|
||||||
if contourArea > max_contour:
|
|
||||||
max_contour = contourArea
|
|
||||||
max_contour_array = contour
|
|
||||||
if contourArea < min_contour:
|
|
||||||
min_contour = contourArea
|
|
||||||
if contourArea > self.CONTOUR_TRESHOLD:
|
|
||||||
contours_tr.append(contour)
|
|
||||||
info = {'max_contour': max_contour,
|
|
||||||
'min_contour': min_contour,
|
|
||||||
'average': sum_contour / max(1, len(contours)),
|
|
||||||
'contour': contours,
|
|
||||||
'max_contour_array': max_contour_array,
|
|
||||||
'contours_tr': contours_tr}
|
|
||||||
return (max_contour > self.CONTOUR_TRESHOLD), info
|
|
||||||
|
|
||||||
@profile
|
|
||||||
def find_moving_object(self, img):
|
|
||||||
"""
|
|
||||||
Сравнивает новый кадр с кадром сохраненным ранее
|
|
||||||
возвращает координаты прямоугольных контуров движущихся объектов
|
|
||||||
"""
|
|
||||||
img = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
|
|
||||||
if self.check_num == 0 or self.frame_check.shape!=img.shape: # обновление сохраненного кадра
|
|
||||||
self.frame_check = img
|
|
||||||
self.check_num = self.FRAME_PERSIST
|
|
||||||
|
|
||||||
self.check_num -= 1
|
|
||||||
diff = cv2.absdiff(self.frame_check, img)
|
|
||||||
contours = self.find_contours(diff)
|
|
||||||
return (self.contour_treshold_info(contours) if self.calibration
|
|
||||||
else self.contour_treshold(contours))
|
|
||||||
|
|
||||||
|
|
||||||
class MainDetector(BaseDetector, YoloDetector):
|
|
||||||
def __init__(self, rtsp, url_post=None):
|
|
||||||
self.yolo_init()
|
|
||||||
self.url_post = url_post
|
|
||||||
self.rtsp = rtsp
|
|
||||||
|
|
||||||
self.status_human = False
|
|
||||||
self.status = False
|
|
||||||
self.time_frame = 0
|
|
||||||
self.read_time = 0
|
|
||||||
|
|
||||||
self.human_contours = []
|
|
||||||
self.moving_detected = None
|
|
||||||
self.frame_human = None
|
|
||||||
self.frame = None
|
|
||||||
self.top = 40
|
|
||||||
self.bottom = 0
|
|
||||||
self.left = 50
|
|
||||||
self.right = 20
|
|
||||||
self.frame_time_between = 0.3
|
|
||||||
self.FRAME_PERSIST = 3
|
|
||||||
self.CONTOUR_TRESHOLD = 300
|
|
||||||
self.calibration = 1
|
|
||||||
|
|
||||||
super().__init__()
|
|
||||||
self.cam_connect()
|
|
||||||
|
|
||||||
@profile
|
|
||||||
def cam_connect(self, retry=3):
|
|
||||||
if retry<0:
|
|
||||||
print('Error connecting to rtsp: ',self.rtsp)
|
|
||||||
quit()
|
|
||||||
self.cam = cv2.VideoCapture(self.rtsp)
|
|
||||||
if not self.cam.isOpened():
|
|
||||||
return self.cam_connect(retry=retry-1)
|
|
||||||
self.cam.set(3, 640)
|
|
||||||
self.cam.set(4, 640)
|
|
||||||
return True
|
|
||||||
|
|
||||||
@profile
|
|
||||||
def frame_read(self, retry=3):
|
|
||||||
if retry<0 and self.cam_connect():
|
|
||||||
return self.frame_read()
|
|
||||||
|
|
||||||
frame_exists, self.frame = self.cam.read()
|
|
||||||
if self.frame is None:
|
|
||||||
return self.frame_read(retry=retry-1)
|
|
||||||
self.read_time = time.time()
|
|
||||||
return True
|
|
||||||
|
|
||||||
@profile
|
|
||||||
def find_moving_in_sub_stream(self):
|
|
||||||
self.frame_margins = self.frame[self.top: self.frame.shape[0] - self.bottom,
|
|
||||||
self.left: self.frame.shape[1] - self.right]
|
|
||||||
self.moving_detected, self.info_moving = self.find_moving_object(self.frame_margins)
|
|
||||||
|
|
||||||
@profile
|
|
||||||
def find_human_in_main_stream(self):
|
|
||||||
status_human, self.human_contours = self.find_human(self.frame)
|
|
||||||
self.status_human = bool(status_human)
|
|
||||||
|
|
||||||
@profile
|
|
||||||
def send_info(self):
|
|
||||||
if self.status==self.status_human:
|
|
||||||
return
|
|
||||||
self.status = self.status_human
|
|
||||||
data = {"status": self.status, 'cam': '22'}
|
|
||||||
print(data)
|
|
||||||
if self.url_post is not None:
|
|
||||||
requests.put(url_post, json.dumps(data))
|
|
||||||
|
|
||||||
@profile
|
|
||||||
def frame_draw(self):
|
|
||||||
self.frame = cv2.putText(self.frame, f'status: {self.status_human}', (50, 50), cv2.FONT_HERSHEY_SIMPLEX,
|
|
||||||
1, (0, 0, 0), 2, cv2.LINE_AA)
|
|
||||||
for contour in self.human_contours:
|
|
||||||
contour_int = list(map(int, contour))
|
|
||||||
self.frame = cv2.rectangle(self.frame,
|
|
||||||
contour_int[:2], contour_int[2:],
|
|
||||||
(0, 0, 255), 3)
|
|
||||||
@profile
|
|
||||||
def frame_show(self):
|
|
||||||
if self.frame is not None:
|
|
||||||
# self.frame_main = cv2.resize(self.frame_main, (320, 320))
|
|
||||||
cv2.imshow('main', self.frame)
|
|
||||||
# if self.frame_sub is not None:
|
|
||||||
# cv2.imshow('sub', self.frame_sub)
|
|
||||||
if cv2.waitKey(1) & 0xFF == ord('q'):
|
|
||||||
quit()
|
|
||||||
|
|
||||||
@profile
|
|
||||||
def detector_step(self):
|
|
||||||
self.find_moving_in_sub_stream()
|
|
||||||
if self.moving_detected != self.status_human:
|
|
||||||
self.find_human_in_main_stream()
|
|
||||||
if self.moving_detected == self.status_human:
|
|
||||||
self.send_info()
|
|
||||||
|
|
||||||
@profile
|
|
||||||
def run(self, count=0):
|
|
||||||
step = int(count > 0)
|
|
||||||
while count >= 0:
|
|
||||||
self.frame_read()
|
|
||||||
if time.time()-self.time_frame<self.frame_time_between:
|
|
||||||
continue
|
|
||||||
self.time_frame = time.time()
|
|
||||||
self.detector_step()
|
|
||||||
if self.calibration:
|
|
||||||
self.frame_draw()
|
|
||||||
self.frame_show()
|
|
||||||
count -= step
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
login = os.environ.get('CAM_LOGIN')
|
|
||||||
password = os.environ.get('CAM_PASSWORD')
|
|
||||||
host = os.environ.get('CAM_HOST')
|
|
||||||
port = os.environ.get('CAM_PORT')
|
|
||||||
|
|
||||||
rtsp = f"rtsp://{login}:{password}@{host}:{port}/view/sub"
|
|
||||||
# /api/v2/service/put_camera_event/
|
|
||||||
url_post = os.environ.get('URL_POST', None)
|
|
||||||
|
|
||||||
detector1 = MainDetector(rtsp, url_post)
|
|
||||||
detector1.run()
|
|
||||||
@ -1,28 +0,0 @@
|
|||||||
import cv2
|
|
||||||
import uvicorn
|
|
||||||
from fastapi import FastAPI
|
|
||||||
from starlette.responses import StreamingResponse
|
|
||||||
import time
|
|
||||||
|
|
||||||
app = FastAPI()
|
|
||||||
|
|
||||||
def generate_video():
|
|
||||||
cap = cv2.VideoCapture('IMG_3995.MOV')
|
|
||||||
|
|
||||||
while True:
|
|
||||||
success, frame = cap.read()
|
|
||||||
if not success:
|
|
||||||
break
|
|
||||||
frame = cv2.resize(frame, (650, 480))
|
|
||||||
_, buffer = cv2.imencode(".jpg", frame)
|
|
||||||
yield (b"--frame\r\n"
|
|
||||||
b"Content-Type: image/jpeg\r\n\r\n" + buffer.tobytes() + b"\r\n")
|
|
||||||
|
|
||||||
time.sleep(0.1)
|
|
||||||
|
|
||||||
@app.get("/video_feed")
|
|
||||||
def video_feed():
|
|
||||||
return StreamingResponse(generate_video(), media_type="multipart/x-mixed-replace; boundary=frame")
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
uvicorn.run(app, host="0.0.0.0", port=8008)
|
|
||||||
@ -1,71 +0,0 @@
|
|||||||
from django.contrib import admin
|
|
||||||
from .models import SystemEvent, WorkPeriod, Document
|
|
||||||
|
|
||||||
# Настройка админки для модели SystemEvent
|
|
||||||
@admin.register(SystemEvent)
|
|
||||||
class SystemEventAdmin(admin.ModelAdmin):
|
|
||||||
list_display = ('machine', 'status', 'timestamp') # Поля, отображаемые в списке
|
|
||||||
list_filter = ('status', 'timestamp') # Фильтры справа
|
|
||||||
search_fields = ('machine__name', 'status') # Поиск по связанным полям
|
|
||||||
ordering = ('-timestamp',) # Сортировка по умолчанию (новые события сверху)
|
|
||||||
date_hierarchy = 'timestamp' # Иерархия по дате
|
|
||||||
|
|
||||||
|
|
||||||
# Настройка админки для модели WorkPeriod
|
|
||||||
@admin.register(WorkPeriod)
|
|
||||||
class WorkPeriodAdmin(admin.ModelAdmin):
|
|
||||||
list_display = ('machine', 'status', 'start_time', 'end_time', 'reason') # Поля, отображаемые в списке
|
|
||||||
list_filter = ('status', 'start_time', 'end_time') # Фильтры справа
|
|
||||||
search_fields = ('machine__name', 'status', 'reason') # Поиск по связанным полям
|
|
||||||
ordering = ('-start_time',) # Сортировка по умолчанию (новые периоды сверху)
|
|
||||||
date_hierarchy = 'start_time' # Иерархия по дате
|
|
||||||
fieldsets = (
|
|
||||||
(None, {
|
|
||||||
'fields': ('machine', 'status', 'start_time', 'end_time')
|
|
||||||
}),
|
|
||||||
('Причина', {
|
|
||||||
'fields': ('reason',),
|
|
||||||
'classes': ('collapse',) # Сворачиваемый блок
|
|
||||||
}),
|
|
||||||
)
|
|
||||||
|
|
||||||
admin.site.register(Document)
|
|
||||||
|
|
||||||
from .models import NeuralNetwork, Machine, Camera
|
|
||||||
|
|
||||||
# Настройка админки для модели NeuralNetwork
|
|
||||||
@admin.register(NeuralNetwork)
|
|
||||||
class NeuralNetworkAdmin(admin.ModelAdmin):
|
|
||||||
list_display = ('name', 'version', 'input_type', 'output_type') # Поля, отображаемые в списке
|
|
||||||
list_filter = ('version', 'input_type', 'output_type') # Фильтры справа
|
|
||||||
search_fields = ('name', 'version') # Поля для поиска
|
|
||||||
ordering = ('name',) # Сортировка по умолчанию
|
|
||||||
fieldsets = (
|
|
||||||
(None, {
|
|
||||||
'fields': ('name', 'version')
|
|
||||||
}),
|
|
||||||
('Типы данных', {
|
|
||||||
'fields': ('input_type', 'output_type')
|
|
||||||
}),
|
|
||||||
)
|
|
||||||
|
|
||||||
# Настройка админки для модели Machine
|
|
||||||
@admin.register(Machine)
|
|
||||||
class MachineAdmin(admin.ModelAdmin):
|
|
||||||
list_display = ('name', 'device_id')
|
|
||||||
|
|
||||||
# Настройка админки для модели Camera
|
|
||||||
@admin.register(Camera)
|
|
||||||
class CameraAdmin(admin.ModelAdmin):
|
|
||||||
list_display = ('machine', 'neural_network_model', 'rtsp') # Поля, отображаемые в списке
|
|
||||||
list_filter = ('machine', 'neural_network_model') # Фильтры справа
|
|
||||||
search_fields = ('machine__name', 'neural_network_model__name') # Поиск по связанным полям
|
|
||||||
ordering = ('machine',) # Сортировка по умолчанию
|
|
||||||
fieldsets = (
|
|
||||||
(None, {
|
|
||||||
'fields': ('machine', 'neural_network_model')
|
|
||||||
}),
|
|
||||||
('RTSP', {
|
|
||||||
'fields': ('rtsp',)
|
|
||||||
}),
|
|
||||||
)
|
|
||||||
@ -1,51 +0,0 @@
|
|||||||
|
|
||||||
.container_table {
|
|
||||||
width: 600px;
|
|
||||||
border: 1px solid #ccc;
|
|
||||||
border-radius: 8px;
|
|
||||||
margin: 10px;
|
|
||||||
padding: 10px;
|
|
||||||
background: white;
|
|
||||||
}
|
|
||||||
|
|
||||||
.header_table {
|
|
||||||
display: flex;
|
|
||||||
justify-content: space-between;
|
|
||||||
align-items: center;
|
|
||||||
cursor: pointer;
|
|
||||||
padding: 10px;
|
|
||||||
background: #f0f0f0;
|
|
||||||
border-radius: 8px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.content_table {
|
|
||||||
max-height: 200px;
|
|
||||||
overflow-y: auto;
|
|
||||||
display: none;
|
|
||||||
margin-top: 10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
table {
|
|
||||||
width: 100%;
|
|
||||||
border-collapse: collapse;
|
|
||||||
}
|
|
||||||
|
|
||||||
th, td {
|
|
||||||
padding: 8px;
|
|
||||||
border-bottom: 1px solid #ddd;
|
|
||||||
}
|
|
||||||
|
|
||||||
tr:hover {
|
|
||||||
background-color: #f1f1f1;
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
|
||||||
|
|
||||||
.icon {
|
|
||||||
font-size: 20px;
|
|
||||||
transition: transform 0.3s;
|
|
||||||
margin-left: 10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.expanded .icon {
|
|
||||||
transform: rotate(180deg);
|
|
||||||
}
|
|
||||||
@ -1,81 +0,0 @@
|
|||||||
body {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
background-color: #F4F5F6;
|
|
||||||
}
|
|
||||||
|
|
||||||
.main-header {
|
|
||||||
display: flex;
|
|
||||||
justify-content: space-between;
|
|
||||||
align-items: center;
|
|
||||||
background-color: #DAE6FF;
|
|
||||||
color: #0A5BFF;
|
|
||||||
padding: 15px 30px;
|
|
||||||
border-radius: 15px;
|
|
||||||
margin: 20px;
|
|
||||||
text-align: center;
|
|
||||||
/* max-width: 1300px; */
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
.content {
|
|
||||||
max-height: 10000px;
|
|
||||||
overflow-y: auto;
|
|
||||||
}
|
|
||||||
|
|
||||||
.top-nav a {
|
|
||||||
color: white;
|
|
||||||
text-decoration: none;
|
|
||||||
margin-left: 15px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.wrapper {
|
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
display: flex;
|
|
||||||
flex-grow: 1;
|
|
||||||
/* margin-top: 20px; */
|
|
||||||
gap: 20px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.sidebar {
|
|
||||||
width: 250px;
|
|
||||||
background-color: #FFFFFF;
|
|
||||||
padding-top: 20px;
|
|
||||||
transition: width 0.3s ease;
|
|
||||||
overflow: hidden;
|
|
||||||
border-radius: 15px;
|
|
||||||
margin-left: 20px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.sidebar a {
|
|
||||||
display: block;
|
|
||||||
color: #8A8894;
|
|
||||||
padding: 10px;
|
|
||||||
text-decoration: none;
|
|
||||||
white-space: nowrap;
|
|
||||||
}
|
|
||||||
|
|
||||||
.sidebar a:hover {
|
|
||||||
background-color: #DAE6FF;
|
|
||||||
}
|
|
||||||
|
|
||||||
.sidebar.collapsed {
|
|
||||||
width: 60px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.sidebar.collapsed a {
|
|
||||||
text-align: 60px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.toggle-btn{
|
|
||||||
background-color: #DAE6FF;
|
|
||||||
border-radius: 6px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.logout-button{
|
|
||||||
background-color: #DAE6FF;
|
|
||||||
border: none;
|
|
||||||
}
|
|
||||||
@ -1,93 +0,0 @@
|
|||||||
/* ckeditor.css */
|
|
||||||
.ck-editor__editable {
|
|
||||||
min-height: 300px;
|
|
||||||
border: 1px solid #e0e0e0;
|
|
||||||
border-radius: 4px;
|
|
||||||
padding: 15px;
|
|
||||||
background-color: #fff;
|
|
||||||
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
|
|
||||||
}
|
|
||||||
|
|
||||||
.ck-toolbar {
|
|
||||||
border: 1px solid #e0e0e0;
|
|
||||||
border-radius: 4px 4px 0 0;
|
|
||||||
background-color: #f5f5f5;
|
|
||||||
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
|
|
||||||
}
|
|
||||||
|
|
||||||
.ck-button {
|
|
||||||
color: #333;
|
|
||||||
border-radius: 4px;
|
|
||||||
transition: background-color 0.2s;
|
|
||||||
}
|
|
||||||
|
|
||||||
.ck-button:hover {
|
|
||||||
background-color: #e0e0e0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.ck-dropdown__panel {
|
|
||||||
border: 1px solid #e0e0e0;
|
|
||||||
border-radius: 4px;
|
|
||||||
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
|
|
||||||
}
|
|
||||||
|
|
||||||
.ck-dropdown__panel .ck-button {
|
|
||||||
padding: 8px 12px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.ck-dropdown__panel .ck-button:hover {
|
|
||||||
background-color: #f0f0f0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.ck-content h1, .ck-content h2, .ck-content h3 {
|
|
||||||
color: #333;
|
|
||||||
font-weight: bold;
|
|
||||||
}
|
|
||||||
|
|
||||||
.ck-content p {
|
|
||||||
color: #555;
|
|
||||||
line-height: 1.6;
|
|
||||||
}
|
|
||||||
|
|
||||||
.ck-content a {
|
|
||||||
color: #007bff;
|
|
||||||
text-decoration: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.ck-content a:hover {
|
|
||||||
text-decoration: underline;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ckeditor.css */
|
|
||||||
.ck-content code {
|
|
||||||
background-color: #f5f5f5;
|
|
||||||
padding: 2px 4px;
|
|
||||||
border-radius: 3px;
|
|
||||||
font-family: "Courier New", monospace;
|
|
||||||
}
|
|
||||||
|
|
||||||
.ck-content table {
|
|
||||||
width: 100%;
|
|
||||||
border-collapse: collapse;
|
|
||||||
margin: 10px 0;
|
|
||||||
background-color: #333;
|
|
||||||
}
|
|
||||||
|
|
||||||
.ck-content table td, .ck-content table th {
|
|
||||||
border: 1px solid #ddd;
|
|
||||||
padding: 8px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.ck-content table th {
|
|
||||||
background-color: #f5f5f5;
|
|
||||||
font-weight: bold;
|
|
||||||
}
|
|
||||||
|
|
||||||
.ck-content .todo-list li {
|
|
||||||
list-style-type: none;
|
|
||||||
margin-left: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.ck-content .todo-list li input[type="checkbox"] {
|
|
||||||
margin-right: 8px;
|
|
||||||
}
|
|
||||||
@ -1,129 +0,0 @@
|
|||||||
:root {
|
|
||||||
--primary: #6366f1;
|
|
||||||
--primary-hover: #4f46e5;
|
|
||||||
--background: #f8fafc;
|
|
||||||
--text: #0f172a;
|
|
||||||
--gradient: linear-gradient(135deg, #6366f1 0%, #a855f7 50%, #ec4899 100%);
|
|
||||||
}
|
|
||||||
|
|
||||||
* {
|
|
||||||
margin: 0;
|
|
||||||
padding: 0;
|
|
||||||
box-sizing: border-box;
|
|
||||||
font-family: 'Segoe UI', system-ui, sans-serif;
|
|
||||||
}
|
|
||||||
|
|
||||||
body {
|
|
||||||
min-height: 100vh;
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
background: var(--background);
|
|
||||||
padding: 1rem;
|
|
||||||
line-height: 1.5;
|
|
||||||
color: var(--text);
|
|
||||||
}
|
|
||||||
|
|
||||||
.error-container {
|
|
||||||
text-align: center;
|
|
||||||
max-width: 600px;
|
|
||||||
padding: 2rem;
|
|
||||||
background: white;
|
|
||||||
border-radius: 1.5rem;
|
|
||||||
box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
|
|
||||||
position: relative;
|
|
||||||
overflow: hidden;
|
|
||||||
}
|
|
||||||
|
|
||||||
.error-container::before {
|
|
||||||
content: '';
|
|
||||||
position: absolute;
|
|
||||||
top: 0;
|
|
||||||
left: 0;
|
|
||||||
right: 0;
|
|
||||||
height: 8px;
|
|
||||||
background: var(--gradient);
|
|
||||||
}
|
|
||||||
|
|
||||||
.error-graphic {
|
|
||||||
width: 200px;
|
|
||||||
height: 200px;
|
|
||||||
margin: 0 auto 2rem;
|
|
||||||
position: relative;
|
|
||||||
animation: float 3s ease-in-out infinite;
|
|
||||||
}
|
|
||||||
|
|
||||||
.error-code {
|
|
||||||
font-size: 4rem;
|
|
||||||
font-weight: 800;
|
|
||||||
background: var(--gradient);
|
|
||||||
-webkit-background-clip: text;
|
|
||||||
background-clip: text;
|
|
||||||
color: transparent;
|
|
||||||
margin-bottom: 0.5rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
h1 {
|
|
||||||
font-size: 1.875rem;
|
|
||||||
margin-bottom: 1rem;
|
|
||||||
color: var(--text);
|
|
||||||
}
|
|
||||||
|
|
||||||
.error-message {
|
|
||||||
color: #64748b;
|
|
||||||
margin-bottom: 2rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.actions {
|
|
||||||
display: flex;
|
|
||||||
gap: 1rem;
|
|
||||||
justify-content: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.btn {
|
|
||||||
padding: 0.75rem 1.5rem;
|
|
||||||
border-radius: 0.5rem;
|
|
||||||
font-weight: 500;
|
|
||||||
transition: all 0.2s;
|
|
||||||
text-decoration: none;
|
|
||||||
display: inline-flex;
|
|
||||||
align-items: center;
|
|
||||||
gap: 0.5rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.btn-primary {
|
|
||||||
background: var(--primary);
|
|
||||||
color: white;
|
|
||||||
border: 2px solid var(--primary);
|
|
||||||
}
|
|
||||||
|
|
||||||
.btn-primary:hover {
|
|
||||||
background: var(--primary-hover);
|
|
||||||
transform: translateY(-2px);
|
|
||||||
}
|
|
||||||
|
|
||||||
.btn-secondary {
|
|
||||||
border: 2px solid #e2e8f0;
|
|
||||||
color: var(--text);
|
|
||||||
background: white;
|
|
||||||
}
|
|
||||||
|
|
||||||
.btn-secondary:hover {
|
|
||||||
border-color: #cbd5e1;
|
|
||||||
background: #f8fafc;
|
|
||||||
}
|
|
||||||
|
|
||||||
@keyframes float {
|
|
||||||
0%, 100% { transform: translateY(0); }
|
|
||||||
50% { transform: translateY(-20px); }
|
|
||||||
}
|
|
||||||
|
|
||||||
@media (max-width: 640px) {
|
|
||||||
.error-code {
|
|
||||||
font-size: 3rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
h1 {
|
|
||||||
font-size: 1.5rem;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
Before Width: | Height: | Size: 101 KiB |
@ -1,104 +0,0 @@
|
|||||||
document.addEventListener('DOMContentLoaded', function () {
|
|
||||||
"use strict"; // Строгий режим
|
|
||||||
|
|
||||||
console.log("DOM загружен"); // Отладочное сообщение
|
|
||||||
|
|
||||||
// Инициализация Scrollspy
|
|
||||||
let scrollSpy = new bootstrap.ScrollSpy(document.body, {
|
|
||||||
target: '#page-nav',
|
|
||||||
smoothScroll: true
|
|
||||||
});
|
|
||||||
|
|
||||||
// Кнопка для мобильной навигации
|
|
||||||
const toggleNavButton = document.getElementById('toggle-nav');
|
|
||||||
const leftNav = document.getElementById('left-nav');
|
|
||||||
const rightNav = document.getElementById('right-nav');
|
|
||||||
|
|
||||||
console.log("toggleNavButton:", toggleNavButton); // Отладочное сообщение
|
|
||||||
console.log("leftNav:", leftNav); // Отладочное сообщение
|
|
||||||
console.log("rightNav:", rightNav); // Отладочное сообщение
|
|
||||||
|
|
||||||
if (toggleNavButton && leftNav && rightNav) {
|
|
||||||
toggleNavButton.addEventListener('click', function () {
|
|
||||||
console.log("Кнопка нажата"); // Отладочное сообщение
|
|
||||||
|
|
||||||
if (leftNav.classList.contains('d-none')) {
|
|
||||||
leftNav.classList.remove('d-none');
|
|
||||||
rightNav.classList.remove('d-none');
|
|
||||||
this.textContent = 'Скрыть навигацию';
|
|
||||||
} else {
|
|
||||||
leftNav.classList.add('d-none');
|
|
||||||
rightNav.classList.add('d-none');
|
|
||||||
this.textContent = 'Показать навигацию';
|
|
||||||
}
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
console.error("Один из элементов не найден"); // Отладочное сообщение
|
|
||||||
}
|
|
||||||
|
|
||||||
// Поиск по странице
|
|
||||||
const searchForm = document.getElementById('search-form');
|
|
||||||
const searchInput = document.getElementById('search-input');
|
|
||||||
|
|
||||||
if (searchForm && searchInput) {
|
|
||||||
searchForm.addEventListener('submit', function (event) {
|
|
||||||
event.preventDefault(); // Отменяем стандартное поведение формы
|
|
||||||
|
|
||||||
const searchQuery = searchInput.value.trim();
|
|
||||||
if (searchQuery === '') {
|
|
||||||
alert('Введите текст для поиска.');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Очищаем предыдущие выделения
|
|
||||||
clearHighlights();
|
|
||||||
|
|
||||||
// Ищем и выделяем текст
|
|
||||||
const pageContents = document.querySelectorAll('.page-content');
|
|
||||||
let found = false;
|
|
||||||
let firstHighlight = null; // Первое найденное выделение
|
|
||||||
|
|
||||||
pageContents.forEach(page => {
|
|
||||||
const contentElements = page.querySelectorAll('.content p'); // Ищем текст внутри <p>
|
|
||||||
contentElements.forEach(element => {
|
|
||||||
const text = element.textContent;
|
|
||||||
const regex = new RegExp(`(${searchQuery})`, 'gi'); // Регулярное выражение для поиска
|
|
||||||
const newText = text.replace(regex, '<span class="highlight">$1</span>'); // Заменяем найденное слово на выделенный текст
|
|
||||||
|
|
||||||
if (newText !== text) {
|
|
||||||
element.innerHTML = newText; // Обновляем содержимое элемента
|
|
||||||
found = true;
|
|
||||||
|
|
||||||
// Если это первое найденное выделение, сохраняем его
|
|
||||||
if (!firstHighlight) {
|
|
||||||
firstHighlight = element.querySelector('.highlight');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
// Прокрутка к первому найденному выделению
|
|
||||||
if (firstHighlight) {
|
|
||||||
firstHighlight.scrollIntoView({
|
|
||||||
behavior: 'smooth', // Плавная прокрутка
|
|
||||||
block: 'center' // Прокрутка к центру экрана
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!found) {
|
|
||||||
alert('Ничего не найдено.');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// Функция для очистки выделений
|
|
||||||
function clearHighlights() {
|
|
||||||
const highlights = document.querySelectorAll('.highlight');
|
|
||||||
highlights.forEach(highlight => {
|
|
||||||
const text = highlight.textContent;
|
|
||||||
highlight.replaceWith(text); // Убираем выделение
|
|
||||||
});
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
console.error("Форма поиска или поле ввода не найдены"); // Отладочное сообщение
|
|
||||||
}
|
|
||||||
});
|
|
||||||
@ -1,60 +0,0 @@
|
|||||||
/* Стили для модального окна */
|
|
||||||
#modal {
|
|
||||||
border: none;
|
|
||||||
border-radius: 10px;
|
|
||||||
padding: 20px;
|
|
||||||
width: 300px;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Заголовок модального окна */
|
|
||||||
.modal-header {
|
|
||||||
font-size: 18px;
|
|
||||||
font-weight: bold;
|
|
||||||
margin-bottom: 10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Метка */
|
|
||||||
.modal-label {
|
|
||||||
display: block;
|
|
||||||
font-size: 14px;
|
|
||||||
opacity: 0.6;
|
|
||||||
margin-bottom: 5px;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Поле ввода */
|
|
||||||
.modal-textarea {
|
|
||||||
width: 100%;
|
|
||||||
height: 80px;
|
|
||||||
border-radius: 8px;
|
|
||||||
border: 1px solid #ccc;
|
|
||||||
padding: 8px;
|
|
||||||
resize: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Подвал модального окна */
|
|
||||||
.modal-footer {
|
|
||||||
display: flex;
|
|
||||||
justify-content: space-between;
|
|
||||||
margin-top: 15px;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Общие стили для кнопок */
|
|
||||||
.modal-button {
|
|
||||||
border: none;
|
|
||||||
font-size: 14px;
|
|
||||||
cursor: pointer;
|
|
||||||
border-radius: 6px;
|
|
||||||
padding: 8px 12px;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Кнопка "Закрыть" */
|
|
||||||
.modal-button.close {
|
|
||||||
background: transparent;
|
|
||||||
color: #007bff;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Кнопка "Отправить" */
|
|
||||||
.modal-button.submit {
|
|
||||||
background-color: #007bff;
|
|
||||||
color: white;
|
|
||||||
}
|
|
||||||
@ -1,46 +0,0 @@
|
|||||||
.documents-container {
|
|
||||||
display: flex;
|
|
||||||
flex-wrap: wrap;
|
|
||||||
gap: 20px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.document-box {
|
|
||||||
border: 1px solid #ddd;
|
|
||||||
padding: 20px;
|
|
||||||
width: 200px;
|
|
||||||
background-color: #f9f9f9;
|
|
||||||
text-align: center;
|
|
||||||
border-radius: 8px;
|
|
||||||
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
|
|
||||||
}
|
|
||||||
|
|
||||||
.document-icon {
|
|
||||||
font-size: 40px;
|
|
||||||
color: #555;
|
|
||||||
margin-bottom: 10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.document-info {
|
|
||||||
font-size: 14px;
|
|
||||||
margin-bottom: 10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.download-link {
|
|
||||||
display: inline-block;
|
|
||||||
padding: 8px 15px;
|
|
||||||
background-color: #0A5BFF;
|
|
||||||
color: white;
|
|
||||||
text-decoration: none;
|
|
||||||
border-radius: 5px;
|
|
||||||
font-size: 14px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.download-link:hover {
|
|
||||||
background-color: #0341be;
|
|
||||||
}
|
|
||||||
|
|
||||||
.no-documents {
|
|
||||||
text-align: center;
|
|
||||||
font-size: 16px;
|
|
||||||
color: #777;
|
|
||||||
}
|
|
||||||
@ -1,65 +0,0 @@
|
|||||||
from django.views.decorators.http import require_http_methods
|
|
||||||
from django.views.decorators.csrf import csrf_exempt
|
|
||||||
from django.http import JsonResponse, HttpResponse
|
|
||||||
from .models import Server
|
|
||||||
import json
|
|
||||||
import uuid
|
|
||||||
import requests
|
|
||||||
from . import api_models
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def get_authorization(request):
|
|
||||||
server_token = request.headers.get("Authorization")
|
|
||||||
if not server_token:
|
|
||||||
return JsonResponse({"text": "Error", "status": 406,
|
|
||||||
"reason": "No token"})
|
|
||||||
try:
|
|
||||||
server_token = uuid.UUID(server_token)
|
|
||||||
except ValueError:
|
|
||||||
return JsonResponse({"text": "Error", "status": 406,
|
|
||||||
"reason": "Invalid UUID format"})
|
|
||||||
|
|
||||||
server_object = Server.objects.filter(token=server_token).first()
|
|
||||||
if server_object is None:
|
|
||||||
return JsonResponse({"text": "Error", "status": 406,
|
|
||||||
"reason": "Invalid token"})
|
|
||||||
return server_object
|
|
||||||
|
|
||||||
@csrf_exempt
|
|
||||||
@require_http_methods(['POST'])
|
|
||||||
def new_events(request):
|
|
||||||
server_object = get_authorization(request)
|
|
||||||
try:
|
|
||||||
data = json.loads(request.read())
|
|
||||||
print(data)
|
|
||||||
except json.decoder.JSONDecodeError:
|
|
||||||
return JsonResponse({"text": "Error", "status": 400,
|
|
||||||
"reason":"invalid Json"})
|
|
||||||
if "events" not in data or type(data["events"])!=list:
|
|
||||||
return JsonResponse({"text": "Error", "status": 400,
|
|
||||||
"reason": "invalid events"})
|
|
||||||
for event in data["events"]:
|
|
||||||
try:
|
|
||||||
data_event = api_models.CameraEvent(**event)
|
|
||||||
camera_object = Camera.objects.filter(id=data_event.camera).first()
|
|
||||||
if camera_object is None:
|
|
||||||
return JsonResponse({"text": "Error", "status": 406,
|
|
||||||
"reason": "Invalid camera id"})
|
|
||||||
|
|
||||||
detector_object = Detector.objects.filter(id=data_event.handler).first()
|
|
||||||
if detector_object is None:
|
|
||||||
return JsonResponse({"text": "Error", "status": 406,
|
|
||||||
"reason": "Invalid detector id"})
|
|
||||||
print(data_event)
|
|
||||||
event_object = CameraEvent.objects.create(camera=camera_object, handler=detector_object, status=int(data_event.status))
|
|
||||||
webhook_receiver_object = WebhookReceiver.objects.filter(cameras=camera_object)
|
|
||||||
for webhook_receiver in webhook_receiver_object:
|
|
||||||
webhook_event = {'status': event_object.status, 'camera_id': event_object.camera.id}
|
|
||||||
requests.put(webhook_receiver.url, data=json.dumps(webhook_event))
|
|
||||||
|
|
||||||
|
|
||||||
except ValueError as e:
|
|
||||||
return JsonResponse({"text": "Error", "status": 400, "reason": "invalid events"})
|
|
||||||
|
|
||||||
return JsonResponse({"text": "Successfully", "status": 200})
|
|
||||||
@ -1,55 +0,0 @@
|
|||||||
{% load static %}
|
|
||||||
<!DOCTYPE html>
|
|
||||||
<html lang="ru">
|
|
||||||
<head>
|
|
||||||
<meta charset="UTF-8">
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
||||||
<title>{% block title %}Страница{% endblock %}</title>
|
|
||||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
|
|
||||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/flatpickr/dist/flatpickr.min.css">
|
|
||||||
<link rel="stylesheet" href="{% static '/base.css' %}">
|
|
||||||
<link rel="stylesheet" href="{% static '/stats.css' %}">
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
|
|
||||||
<!-- Верхний заголовок -->
|
|
||||||
<header class="main-header">
|
|
||||||
<!-- Кнопка сворачивания -->
|
|
||||||
<button class="toggle-btn" id="toggle-btn">⇦</button>
|
|
||||||
<h1>Мониторинг системы</h1>
|
|
||||||
<nav class="top-nav">
|
|
||||||
{% if user.is_authenticated %}
|
|
||||||
<form action="{% url 'logout' %}" method="post">
|
|
||||||
{% csrf_token %}
|
|
||||||
<button type="submit" class="logout-button">Выйти</button>
|
|
||||||
</form>
|
|
||||||
{% else %}
|
|
||||||
<a href="{% url 'login' %}">Войти</a>
|
|
||||||
{% endif %}
|
|
||||||
</nav>
|
|
||||||
</header>
|
|
||||||
|
|
||||||
<div class="wrapper">
|
|
||||||
<!-- Сайдбар -->
|
|
||||||
<div class="sidebar" id="sidebar">
|
|
||||||
<a href="/stats">Статистика работы</a>
|
|
||||||
<a href="/reason/">Периоды простоя</a>
|
|
||||||
<a href="/report/">Отчеты</a>
|
|
||||||
<a href="/client_admin/">Администрирование</a>
|
|
||||||
</div>
|
|
||||||
<!-- Контент -->
|
|
||||||
<div class="content">
|
|
||||||
{% block content %}{% endblock %}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
document.getElementById("toggle-btn").addEventListener("click", function () {
|
|
||||||
let sidebar = document.getElementById("sidebar");
|
|
||||||
sidebar.classList.toggle("collapsed");
|
|
||||||
this.textContent = sidebar.classList.contains("collapsed") ? "⇨" : "⇦";
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
@ -1,51 +0,0 @@
|
|||||||
{% extends "base.html" %}
|
|
||||||
{% load static %}
|
|
||||||
{% block title %}Администрирование{% endblock %}
|
|
||||||
|
|
||||||
{% block content %}
|
|
||||||
<link rel="stylesheet" href="{% static '/admin_table.css' %}">
|
|
||||||
<div class="main-container">
|
|
||||||
<div class="left-panel">
|
|
||||||
{% for table in data %}
|
|
||||||
<div class="container_table">
|
|
||||||
<div class="header_table" onclick="toggleContent(this)">
|
|
||||||
<span>{{ table.name }}</span>
|
|
||||||
<div>
|
|
||||||
<a class="button" href="/admin/client_app/{{ add }}/add/">Добавить</a>
|
|
||||||
<span class="icon">▼</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="content_table">
|
|
||||||
<table>
|
|
||||||
<tr>
|
|
||||||
{% for field in table.fields %}
|
|
||||||
<th>{{ field }}</th>
|
|
||||||
{% endfor %}
|
|
||||||
</tr>
|
|
||||||
{% for values in table.model_values %}
|
|
||||||
<tr>
|
|
||||||
{% for value in values %}
|
|
||||||
<td>{{ value }}</td> <!-- Directly accessing field in dictionary -->
|
|
||||||
{% endfor %}
|
|
||||||
</tr>
|
|
||||||
{% endfor %}
|
|
||||||
</table>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{% endfor %}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
function toggleContent(element) {
|
|
||||||
let container = element.closest('.container_table');
|
|
||||||
let content = container.querySelector('.content_table');
|
|
||||||
content.style.display = content.style.display === 'none' || content.style.display === '' ? 'block' : 'none';
|
|
||||||
container.classList.toggle('expanded');
|
|
||||||
}
|
|
||||||
|
|
||||||
function openDetail(model, id) {
|
|
||||||
window.location.href = `/${model}/${id}/`;
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
{% endblock %}
|
|
||||||
@ -1,19 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html lang="ru">
|
|
||||||
<head>
|
|
||||||
<meta charset="UTF-8">
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
||||||
<title>{{ model_name }} - Детали</title>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
|
|
||||||
<h2>Детали объекта из {{ model_name }}</h2>
|
|
||||||
<ul>
|
|
||||||
{% for field, value in object.get_fields.items %}
|
|
||||||
<li><strong>{{ field }}:</strong> {{ value }}</li>
|
|
||||||
{% endfor %}
|
|
||||||
</ul>
|
|
||||||
<a href="/{{ model_name }}/">Назад</a>
|
|
||||||
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
@ -1,100 +0,0 @@
|
|||||||
{% extends "base.html" %}
|
|
||||||
{% load static %}
|
|
||||||
|
|
||||||
{% block title %}Периоды простоя{% endblock %}
|
|
||||||
|
|
||||||
{% block content %}
|
|
||||||
<div class="main-container">
|
|
||||||
<div class="left-panel">
|
|
||||||
<canvas id="myChart"></canvas>
|
|
||||||
</div>
|
|
||||||
<div class="right-panel">
|
|
||||||
<div class="small-box">
|
|
||||||
<span class="label-box", style="background-color: #B6EDE3; color: #00133B;">Активен</span>
|
|
||||||
<span class="label-box", style="background-color: #F8C0B9; color: #00133B;">Простаивает</span>
|
|
||||||
<span class="label-box", style="background-color: #EBF0F9; color: #00133B;">Указана причина простоя</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<dialog id="modal">
|
|
||||||
<div class="modal-header">Форма ввода</div>
|
|
||||||
<div class="modal-body">
|
|
||||||
<label for="reason" class="modal-label">Причина простоя:</label>
|
|
||||||
<textarea id="reason" class="modal-textarea"></textarea>
|
|
||||||
</div>
|
|
||||||
<div class="modal-footer">
|
|
||||||
<button id="closeModal" class="modal-button close">Закрыть</button>
|
|
||||||
<button id="submitModal" class="modal-button submit">Отправить</button>
|
|
||||||
</div>
|
|
||||||
</dialog>
|
|
||||||
<link rel="stylesheet" href="{% static '/reason-modal.css' %}">
|
|
||||||
|
|
||||||
|
|
||||||
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
|
|
||||||
|
|
||||||
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
|
|
||||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/axios/1.4.0/axios.min.js"></script>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
const ctx = document.getElementById('myChart').getContext('2d');
|
|
||||||
|
|
||||||
let myChart = new Chart(ctx, {
|
|
||||||
type: 'bar',
|
|
||||||
data: { labels: [], datasets: [] },
|
|
||||||
options: {
|
|
||||||
responsive: true,
|
|
||||||
maintainAspectRatio: false,
|
|
||||||
animation: false,
|
|
||||||
plugins: {
|
|
||||||
legend: {
|
|
||||||
display: false
|
|
||||||
}
|
|
||||||
},
|
|
||||||
scales: {
|
|
||||||
x: { stacked: true,
|
|
||||||
},
|
|
||||||
y: {
|
|
||||||
stacked: true,
|
|
||||||
ticks: {
|
|
||||||
stepSize: 1,
|
|
||||||
beginAtZero: true,
|
|
||||||
suggestedMax: 12,
|
|
||||||
callback: function(value) {
|
|
||||||
return `${9 + value}:00`;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
onClick: (event, elements) => {
|
|
||||||
if (elements.length > 0) {
|
|
||||||
const datasetIndex = elements[0].datasetIndex;
|
|
||||||
const dataset = myChart.data.datasets[datasetIndex];
|
|
||||||
const timeRangeId = dataset.id;
|
|
||||||
const url = `/details?id=${encodeURIComponent(timeRangeId)}`;
|
|
||||||
const modal = document.getElementById("modal");
|
|
||||||
modal.showModal();
|
|
||||||
// document.getElementById("openModal").addEventListener("click", () => modal.showModal());
|
|
||||||
document.getElementById("closeModal").addEventListener("click", () => modal.close());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
function updateChart() {
|
|
||||||
axios.get('/chart-data/')
|
|
||||||
.then(response => {
|
|
||||||
myChart.data.labels = response.data.labels;
|
|
||||||
myChart.data.datasets = response.data.datasets;
|
|
||||||
myChart.update();
|
|
||||||
})
|
|
||||||
.catch(error => console.error("Ошибка при обновлении графика:", error));
|
|
||||||
}
|
|
||||||
|
|
||||||
setInterval(updateChart, 2000);
|
|
||||||
updateChart();
|
|
||||||
</script>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
{% endblock %}
|
|
||||||
@ -1,85 +0,0 @@
|
|||||||
{% extends "base.html" %}
|
|
||||||
{% load static %}
|
|
||||||
{% block title %}Система отчетов{% endblock %}
|
|
||||||
|
|
||||||
{% block content %}
|
|
||||||
<link rel="stylesheet" href="{% static '/report.css' %}">
|
|
||||||
<div class="main-container">
|
|
||||||
<div class="left-panel">
|
|
||||||
<h3>Документы</h3>
|
|
||||||
<div class="documents-container">
|
|
||||||
{% for document in documents %}
|
|
||||||
<div class="document-box">
|
|
||||||
<!-- Иконка документа -->
|
|
||||||
<div class="document-icon">
|
|
||||||
<i class="fa fa-file-alt"></i> <!-- Используется иконка из Font Awesome -->
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="document-info">
|
|
||||||
<strong>{{ document.title }}</strong><br>
|
|
||||||
<small>Создано: {{ document.created_at|date:"Y-m-d H:i" }}</small>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Ссылка для скачивания -->
|
|
||||||
<a href="{{ document.file.url }}" class="download-link" download>
|
|
||||||
Скачать
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
{% empty %}
|
|
||||||
<div class="no-documents">Нет доступных документов.</div>
|
|
||||||
{% endfor %}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="right-panel">
|
|
||||||
<div class="small-box">
|
|
||||||
<strong>Фильтры</strong>
|
|
||||||
<div class="input-container">
|
|
||||||
<span>Время:</span>
|
|
||||||
<input type="text" id="dateRangePicker" placeholder="Выберите диапазон">
|
|
||||||
</div>
|
|
||||||
<div class="input-container">
|
|
||||||
<span>Сотрудник:</span>
|
|
||||||
<select id="dropdown" name="options">
|
|
||||||
<option value="1">1</option>
|
|
||||||
<option value="2">2</option>
|
|
||||||
<option value="3">3</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<span class="button-box" id="openModal">новый отчет</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Модальное окно для создания отчета -->
|
|
||||||
<dialog id="modal">
|
|
||||||
<form method="dialog">
|
|
||||||
<h3>Создание нового отчета</h3>
|
|
||||||
<label for="reportTitle">Название отчета:</label>
|
|
||||||
<input type="text" id="reportTitle" name="title" required><br>
|
|
||||||
<label for="reportDescription">Описание:</label>
|
|
||||||
<textarea id="reportDescription" name="description" required></textarea><br>
|
|
||||||
<button type="submit">Создать отчет</button>
|
|
||||||
<button type="button" id="closeModal">Отменить</button>
|
|
||||||
</form>
|
|
||||||
</dialog>
|
|
||||||
|
|
||||||
<script src="https://npmcdn.com/flatpickr/dist/flatpickr.min.js"></script>
|
|
||||||
<script src="https://npmcdn.com/flatpickr/dist/l10n/ru.js"></script>
|
|
||||||
<script>
|
|
||||||
// Инициализация Flatpickr для выбора диапазона дат
|
|
||||||
flatpickr("#dateRangePicker", {
|
|
||||||
mode: "range",
|
|
||||||
dateFormat: "Y-m-d",
|
|
||||||
locale: "ru"
|
|
||||||
});
|
|
||||||
|
|
||||||
// Открытие модального окна
|
|
||||||
const modal = document.getElementById("modal");
|
|
||||||
const openModalButton = document.getElementById("openModal");
|
|
||||||
const closeModalButton = document.getElementById("closeModal");
|
|
||||||
|
|
||||||
openModalButton.addEventListener("click", () => modal.showModal());
|
|
||||||
closeModalButton.addEventListener("click", () => modal.close());
|
|
||||||
</script>
|
|
||||||
{% endblock %}
|
|
||||||
@ -1,45 +0,0 @@
|
|||||||
{% extends "base.html" %}
|
|
||||||
|
|
||||||
{% block title %}Статистика оборудования{% endblock %}
|
|
||||||
|
|
||||||
{% block content %}
|
|
||||||
<div class="main-container">
|
|
||||||
<div class="left-panel">
|
|
||||||
<img id="stream" src="http://192.168.31.56:8008/video_feed" alt="RTSP-поток" style="width: 100%; height: auto;">
|
|
||||||
</div>
|
|
||||||
<div class="right-panel">
|
|
||||||
<div class="small-box">
|
|
||||||
<strong>Информация</strong>
|
|
||||||
<div class="label-container">
|
|
||||||
<span>Статус:</span>
|
|
||||||
<span class="label-box">Загрузка...</span>
|
|
||||||
</div>
|
|
||||||
<div class="label-container">
|
|
||||||
<span>Время работы:</span>
|
|
||||||
<span class="run_time">0ч. 0м. 0.с</span>
|
|
||||||
</div>
|
|
||||||
<div class="label-container">
|
|
||||||
<span>Время простоя:</span>
|
|
||||||
<span class="sleep_time">0ч. 0м. 0.с</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<script>
|
|
||||||
function updateStatus() {
|
|
||||||
fetch('/get_status/')
|
|
||||||
.then(response => response.json())
|
|
||||||
.then(data => {
|
|
||||||
let labelBox = document.querySelector(".label-box");
|
|
||||||
labelBox.textContent = data.value;
|
|
||||||
labelBox.style.backgroundColor = data.color;
|
|
||||||
document.querySelector(".run_time").textContent = data.run_time;
|
|
||||||
document.querySelector(".sleep_time").textContent = data.sleep_time;
|
|
||||||
})
|
|
||||||
.catch(error => console.error('Ошибка загрузки:', error));
|
|
||||||
}
|
|
||||||
|
|
||||||
setInterval(updateStatus, 2000);
|
|
||||||
document.addEventListener("DOMContentLoaded", updateStatus);
|
|
||||||
</script>
|
|
||||||
{% endblock %}
|
|
||||||
@ -1,3 +0,0 @@
|
|||||||
from django.test import TestCase
|
|
||||||
|
|
||||||
# Create your tests here.
|
|
||||||
@ -1,112 +0,0 @@
|
|||||||
from django.shortcuts import render
|
|
||||||
from django.http import HttpResponse
|
|
||||||
from django.http import JsonResponse
|
|
||||||
import time
|
|
||||||
import datetime
|
|
||||||
from django.contrib.auth.decorators import login_required
|
|
||||||
from django.contrib.auth.views import LoginView
|
|
||||||
from .models import Document
|
|
||||||
|
|
||||||
from django.apps import apps
|
|
||||||
from django.shortcuts import render, get_object_or_404
|
|
||||||
|
|
||||||
|
|
||||||
GREEN = "rgb(182, 237, 227)"
|
|
||||||
RED = "rgb(248, 192, 185)"
|
|
||||||
GRAY = "rgb(224, 226, 229)"
|
|
||||||
|
|
||||||
|
|
||||||
class CustomLoginView(LoginView):
|
|
||||||
template_name = 'auth/login.html'
|
|
||||||
redirect_authenticated_user = True
|
|
||||||
|
|
||||||
|
|
||||||
@login_required
|
|
||||||
def get_status(request):
|
|
||||||
|
|
||||||
status = 0
|
|
||||||
value = ["Простаивает", "Работает"][status]
|
|
||||||
color = ["#FBE0DD", "#DCF6F1"][status]
|
|
||||||
td = datetime.timedelta(seconds=time.time())
|
|
||||||
hours, remainder = divmod(td.seconds, 3600)
|
|
||||||
minutes, sec = divmod(remainder, 60)
|
|
||||||
t = f"{hours} ч. {minutes} м. {sec} с."
|
|
||||||
return JsonResponse({'value': value, 'color': color, 'run_time': t, 'sleep_time': t})
|
|
||||||
|
|
||||||
@login_required
|
|
||||||
def get_chart_data(request):
|
|
||||||
# тут получаются данные для графика периодов простоя
|
|
||||||
data = {
|
|
||||||
"labels": ["Активность"],
|
|
||||||
"datasets": [
|
|
||||||
{"label": "time", "data": [5], "backgroundColor": GREEN, "id": 0, "borderRadius": 8},
|
|
||||||
{"label": "time", "data": [1], "backgroundColor": GRAY, "id": 0, "borderRadius": 8},
|
|
||||||
{"label": "time", "data": [3], "backgroundColor": GREEN, "id": 0, "borderRadius": 8},
|
|
||||||
{"label": "time", "data": [3], "backgroundColor": RED, "id": 0, "borderRadius": 8}]
|
|
||||||
}
|
|
||||||
return JsonResponse(data)
|
|
||||||
|
|
||||||
@login_required
|
|
||||||
def stats_page(request):
|
|
||||||
# страница с видеопотоком и блоком информации
|
|
||||||
context = {"status": "Простаивает"}
|
|
||||||
return render(request, "client_app/stats.html", context)
|
|
||||||
|
|
||||||
@login_required
|
|
||||||
def report_page(request):
|
|
||||||
# страница с отчетами
|
|
||||||
documents = Document.objects.all()
|
|
||||||
return render(request, "client_app/report.html", {'documents': documents})
|
|
||||||
|
|
||||||
@login_required
|
|
||||||
def reason_page(request):
|
|
||||||
# страница с графиком периодов простоя
|
|
||||||
return render(request, "client_app/reason.html")
|
|
||||||
|
|
||||||
@login_required
|
|
||||||
def admin_client(request):
|
|
||||||
data = []
|
|
||||||
model_name_list = ["Machine", "Worker" ]
|
|
||||||
for model_name in model_name_list:
|
|
||||||
model = apps.get_model('client_app', model_name)
|
|
||||||
objects = model.objects.all()
|
|
||||||
model_values = []
|
|
||||||
for obj in objects:
|
|
||||||
values = [getattr(obj, field.name) for field in model._meta.fields]
|
|
||||||
model_values.append(values)
|
|
||||||
model_data = {'name': model_name.lower(),
|
|
||||||
'fields': [field.verbose_name for field in model._meta.fields],
|
|
||||||
'model_values': model_values,
|
|
||||||
}
|
|
||||||
data.append(model_data)
|
|
||||||
return render(request, 'client_app/admin_client.html', {
|
|
||||||
'data': data
|
|
||||||
})
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def dynamic_table(request, model_name):
|
|
||||||
model = apps.get_model('client_app', model_name)
|
|
||||||
fields = [field.verbose_name for field in model._meta.fields]
|
|
||||||
objects = model.objects.all()
|
|
||||||
result = []
|
|
||||||
|
|
||||||
for obj in objects:
|
|
||||||
values = [getattr(obj, field.name) for field in model._meta.fields]
|
|
||||||
result.append(values)
|
|
||||||
|
|
||||||
return render(request, 'client_app/admin_table.html', {
|
|
||||||
'model_name': model_name,
|
|
||||||
'fields': fields,
|
|
||||||
'objects': result,
|
|
||||||
'add': model_name.lower()
|
|
||||||
})
|
|
||||||
|
|
||||||
def dynamic_detail(request, model_name, object_id):
|
|
||||||
model = apps.get_model('client_app', model_name)
|
|
||||||
obj = get_object_or_404(model, id=object_id)
|
|
||||||
|
|
||||||
return render(request, 'dynamic_detail.html', {
|
|
||||||
'model_name': model_name,
|
|
||||||
'object': obj
|
|
||||||
})
|
|
||||||
@ -1,10 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
set -e
|
|
||||||
|
|
||||||
python manage.py makemigrations --noinput
|
|
||||||
python manage.py migrate --noinput
|
|
||||||
python manage.py collectstatic --noinput
|
|
||||||
|
|
||||||
|
|
||||||
exec "$@"
|
|
||||||
@ -1,51 +0,0 @@
|
|||||||
|
|
||||||
.container_table {
|
|
||||||
width: 600px;
|
|
||||||
border: 1px solid #ccc;
|
|
||||||
border-radius: 8px;
|
|
||||||
margin: 10px;
|
|
||||||
padding: 10px;
|
|
||||||
background: white;
|
|
||||||
}
|
|
||||||
|
|
||||||
.header_table {
|
|
||||||
display: flex;
|
|
||||||
justify-content: space-between;
|
|
||||||
align-items: center;
|
|
||||||
cursor: pointer;
|
|
||||||
padding: 10px;
|
|
||||||
background: #f0f0f0;
|
|
||||||
border-radius: 8px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.content_table {
|
|
||||||
max-height: 200px;
|
|
||||||
overflow-y: auto;
|
|
||||||
display: none;
|
|
||||||
margin-top: 10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
table {
|
|
||||||
width: 100%;
|
|
||||||
border-collapse: collapse;
|
|
||||||
}
|
|
||||||
|
|
||||||
th, td {
|
|
||||||
padding: 8px;
|
|
||||||
border-bottom: 1px solid #ddd;
|
|
||||||
}
|
|
||||||
|
|
||||||
tr:hover {
|
|
||||||
background-color: #f1f1f1;
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
|
||||||
|
|
||||||
.icon {
|
|
||||||
font-size: 20px;
|
|
||||||
transition: transform 0.3s;
|
|
||||||
margin-left: 10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.expanded .icon {
|
|
||||||
transform: rotate(180deg);
|
|
||||||
}
|
|
||||||
@ -1,82 +0,0 @@
|
|||||||
body {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
background-color: #F4F5F6;
|
|
||||||
}
|
|
||||||
|
|
||||||
.main-header {
|
|
||||||
display: flex;
|
|
||||||
justify-content: space-between;
|
|
||||||
align-items: center;
|
|
||||||
background-color: #DAE6FF;
|
|
||||||
color: #0A5BFF;
|
|
||||||
padding: 15px 30px;
|
|
||||||
border-radius: 15px;
|
|
||||||
margin: 20px;
|
|
||||||
text-align: center;
|
|
||||||
/* max-width: 1300px; */
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
.content {
|
|
||||||
max-height: 10000px;
|
|
||||||
overflow-y: auto;
|
|
||||||
}
|
|
||||||
|
|
||||||
.top-nav a {
|
|
||||||
color: white;
|
|
||||||
text-decoration: none;
|
|
||||||
margin-left: 15px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.wrapper {
|
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
display: flex;
|
|
||||||
flex-grow: 1;
|
|
||||||
/* margin-top: 20px; */
|
|
||||||
gap: 20px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.sidebar {
|
|
||||||
height: 100%;
|
|
||||||
width: 250px;
|
|
||||||
background-color: #FFFFFF;
|
|
||||||
padding-top: 20px;
|
|
||||||
transition: width 0.3s ease;
|
|
||||||
overflow: hidden;
|
|
||||||
border-radius: 15px;
|
|
||||||
margin-left: 20px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.sidebar a {
|
|
||||||
display: block;
|
|
||||||
color: #8A8894;
|
|
||||||
padding: 10px;
|
|
||||||
text-decoration: none;
|
|
||||||
white-space: nowrap;
|
|
||||||
}
|
|
||||||
|
|
||||||
.sidebar a:hover {
|
|
||||||
background-color: #DAE6FF;
|
|
||||||
}
|
|
||||||
|
|
||||||
.sidebar.collapsed {
|
|
||||||
width: 60px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.sidebar.collapsed a {
|
|
||||||
text-align: 60px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.toggle-btn{
|
|
||||||
background-color: #DAE6FF;
|
|
||||||
border-radius: 6px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.logout-button{
|
|
||||||
background-color: #DAE6FF;
|
|
||||||
border: none;
|
|
||||||
}
|
|
||||||
2016
service/zircon_web/staticfiles/bootstrap-icons.css
vendored
@ -1,93 +0,0 @@
|
|||||||
/* ckeditor.css */
|
|
||||||
.ck-editor__editable {
|
|
||||||
min-height: 300px;
|
|
||||||
border: 1px solid #e0e0e0;
|
|
||||||
border-radius: 4px;
|
|
||||||
padding: 15px;
|
|
||||||
background-color: #fff;
|
|
||||||
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
|
|
||||||
}
|
|
||||||
|
|
||||||
.ck-toolbar {
|
|
||||||
border: 1px solid #e0e0e0;
|
|
||||||
border-radius: 4px 4px 0 0;
|
|
||||||
background-color: #f5f5f5;
|
|
||||||
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
|
|
||||||
}
|
|
||||||
|
|
||||||
.ck-button {
|
|
||||||
color: #333;
|
|
||||||
border-radius: 4px;
|
|
||||||
transition: background-color 0.2s;
|
|
||||||
}
|
|
||||||
|
|
||||||
.ck-button:hover {
|
|
||||||
background-color: #e0e0e0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.ck-dropdown__panel {
|
|
||||||
border: 1px solid #e0e0e0;
|
|
||||||
border-radius: 4px;
|
|
||||||
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
|
|
||||||
}
|
|
||||||
|
|
||||||
.ck-dropdown__panel .ck-button {
|
|
||||||
padding: 8px 12px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.ck-dropdown__panel .ck-button:hover {
|
|
||||||
background-color: #f0f0f0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.ck-content h1, .ck-content h2, .ck-content h3 {
|
|
||||||
color: #333;
|
|
||||||
font-weight: bold;
|
|
||||||
}
|
|
||||||
|
|
||||||
.ck-content p {
|
|
||||||
color: #555;
|
|
||||||
line-height: 1.6;
|
|
||||||
}
|
|
||||||
|
|
||||||
.ck-content a {
|
|
||||||
color: #007bff;
|
|
||||||
text-decoration: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.ck-content a:hover {
|
|
||||||
text-decoration: underline;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ckeditor.css */
|
|
||||||
.ck-content code {
|
|
||||||
background-color: #f5f5f5;
|
|
||||||
padding: 2px 4px;
|
|
||||||
border-radius: 3px;
|
|
||||||
font-family: "Courier New", monospace;
|
|
||||||
}
|
|
||||||
|
|
||||||
.ck-content table {
|
|
||||||
width: 100%;
|
|
||||||
border-collapse: collapse;
|
|
||||||
margin: 10px 0;
|
|
||||||
background-color: #333;
|
|
||||||
}
|
|
||||||
|
|
||||||
.ck-content table td, .ck-content table th {
|
|
||||||
border: 1px solid #ddd;
|
|
||||||
padding: 8px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.ck-content table th {
|
|
||||||
background-color: #f5f5f5;
|
|
||||||
font-weight: bold;
|
|
||||||
}
|
|
||||||
|
|
||||||
.ck-content .todo-list li {
|
|
||||||
list-style-type: none;
|
|
||||||
margin-left: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.ck-content .todo-list li input[type="checkbox"] {
|
|
||||||
margin-right: 8px;
|
|
||||||
}
|
|
||||||
@ -1,71 +0,0 @@
|
|||||||
body {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
margin: 0;
|
|
||||||
margin-top: 100px;
|
|
||||||
margin-left: 100px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.main-header {
|
|
||||||
display: flex;
|
|
||||||
justify-content: space-between;
|
|
||||||
align-items: center;
|
|
||||||
background-color: #DAE6FF;
|
|
||||||
color: #0A5BFF;
|
|
||||||
padding: 15px 30px;
|
|
||||||
border-radius: 15px;
|
|
||||||
margin-top: 20px;
|
|
||||||
margin-left: 20px;
|
|
||||||
text-align: center;
|
|
||||||
max-width: 1300px;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
.top-nav a {
|
|
||||||
color: white;
|
|
||||||
text-decoration: none;
|
|
||||||
margin-left: 15px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.wrapper {
|
|
||||||
display: flex;
|
|
||||||
flex-grow: 1;
|
|
||||||
margin-top: 20px;
|
|
||||||
gap: 20px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.sidebar {
|
|
||||||
height: 100vh;
|
|
||||||
width: 250px;
|
|
||||||
background-color: #FFFFFF;
|
|
||||||
padding-top: 20px;
|
|
||||||
transition: width 0.3s ease;
|
|
||||||
overflow: hidden;
|
|
||||||
border-radius: 15px;
|
|
||||||
margin-left: 20px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.sidebar a {
|
|
||||||
display: block;
|
|
||||||
color: #8A8894;
|
|
||||||
padding: 10px;
|
|
||||||
text-decoration: none;
|
|
||||||
white-space: nowrap;
|
|
||||||
}
|
|
||||||
|
|
||||||
.sidebar a:hover {
|
|
||||||
background-color: #DAE6FF;
|
|
||||||
}
|
|
||||||
|
|
||||||
.sidebar.collapsed {
|
|
||||||
width: 60px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.sidebar.collapsed a {
|
|
||||||
text-align: 60px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.toggle-btn{
|
|
||||||
background-color: #DAE6FF;
|
|
||||||
border-radius: 6px;
|
|
||||||
}
|
|
||||||
|
Before Width: | Height: | Size: 101 KiB |
@ -1,80 +0,0 @@
|
|||||||
body {
|
|
||||||
background-color: #F4F5F6;
|
|
||||||
margin: 0;
|
|
||||||
padding: 0;
|
|
||||||
}
|
|
||||||
.title-box {
|
|
||||||
background: #DAE6FF;
|
|
||||||
/* padding: 15px 30px; */
|
|
||||||
border-radius: 10px;
|
|
||||||
color: #0A5BFF;
|
|
||||||
font-size: 48px;
|
|
||||||
font-weight: bold;
|
|
||||||
text-align: center;
|
|
||||||
max-width: 1000px;
|
|
||||||
width: 100%;
|
|
||||||
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
|
|
||||||
}
|
|
||||||
.main-container {
|
|
||||||
background-color: #F4F5F6;
|
|
||||||
display: flex;
|
|
||||||
/* flex-direction: column; */
|
|
||||||
gap: 20px;
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
.left-panel {
|
|
||||||
flex: 2;
|
|
||||||
background: #FFFFFF;
|
|
||||||
border-radius: 10px;
|
|
||||||
padding: 20px;
|
|
||||||
height: 500px;
|
|
||||||
max-width: 700px;
|
|
||||||
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
|
|
||||||
}
|
|
||||||
.right-panel {
|
|
||||||
flex: 1;
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
gap: 20px;
|
|
||||||
max-width: 300px;
|
|
||||||
}
|
|
||||||
.small-box {
|
|
||||||
background: #FFFFFF;
|
|
||||||
border-radius: 10px;
|
|
||||||
padding: 20px;
|
|
||||||
height: 200px;
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
align-items: flex-start;
|
|
||||||
justify-content: flex-start;
|
|
||||||
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
.button-box {
|
|
||||||
background: #0A5BFF;
|
|
||||||
color: white;
|
|
||||||
text-align: center;
|
|
||||||
border-radius: 10px;
|
|
||||||
padding: 15px;
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
|
||||||
|
|
||||||
.button-box:hover{
|
|
||||||
background: #0952E6;
|
|
||||||
}
|
|
||||||
.label-container {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
gap: 10px;
|
|
||||||
}
|
|
||||||
.label-box {
|
|
||||||
background: #C5CCD4;
|
|
||||||
padding: 5px;
|
|
||||||
border-radius: 5px;
|
|
||||||
}
|
|
||||||
.report-box {
|
|
||||||
background: white;
|
|
||||||
display: flex;
|
|
||||||
border-radius: 10px;
|
|
||||||
}
|
|
||||||
@ -1,129 +0,0 @@
|
|||||||
:root {
|
|
||||||
--primary: #6366f1;
|
|
||||||
--primary-hover: #4f46e5;
|
|
||||||
--background: #f8fafc;
|
|
||||||
--text: #0f172a;
|
|
||||||
--gradient: linear-gradient(135deg, #6366f1 0%, #a855f7 50%, #ec4899 100%);
|
|
||||||
}
|
|
||||||
|
|
||||||
* {
|
|
||||||
margin: 0;
|
|
||||||
padding: 0;
|
|
||||||
box-sizing: border-box;
|
|
||||||
font-family: 'Segoe UI', system-ui, sans-serif;
|
|
||||||
}
|
|
||||||
|
|
||||||
body {
|
|
||||||
min-height: 100vh;
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
background: var(--background);
|
|
||||||
padding: 1rem;
|
|
||||||
line-height: 1.5;
|
|
||||||
color: var(--text);
|
|
||||||
}
|
|
||||||
|
|
||||||
.error-container {
|
|
||||||
text-align: center;
|
|
||||||
max-width: 600px;
|
|
||||||
padding: 2rem;
|
|
||||||
background: white;
|
|
||||||
border-radius: 1.5rem;
|
|
||||||
box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
|
|
||||||
position: relative;
|
|
||||||
overflow: hidden;
|
|
||||||
}
|
|
||||||
|
|
||||||
.error-container::before {
|
|
||||||
content: '';
|
|
||||||
position: absolute;
|
|
||||||
top: 0;
|
|
||||||
left: 0;
|
|
||||||
right: 0;
|
|
||||||
height: 8px;
|
|
||||||
background: var(--gradient);
|
|
||||||
}
|
|
||||||
|
|
||||||
.error-graphic {
|
|
||||||
width: 200px;
|
|
||||||
height: 200px;
|
|
||||||
margin: 0 auto 2rem;
|
|
||||||
position: relative;
|
|
||||||
animation: float 3s ease-in-out infinite;
|
|
||||||
}
|
|
||||||
|
|
||||||
.error-code {
|
|
||||||
font-size: 4rem;
|
|
||||||
font-weight: 800;
|
|
||||||
background: var(--gradient);
|
|
||||||
-webkit-background-clip: text;
|
|
||||||
background-clip: text;
|
|
||||||
color: transparent;
|
|
||||||
margin-bottom: 0.5rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
h1 {
|
|
||||||
font-size: 1.875rem;
|
|
||||||
margin-bottom: 1rem;
|
|
||||||
color: var(--text);
|
|
||||||
}
|
|
||||||
|
|
||||||
.error-message {
|
|
||||||
color: #64748b;
|
|
||||||
margin-bottom: 2rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.actions {
|
|
||||||
display: flex;
|
|
||||||
gap: 1rem;
|
|
||||||
justify-content: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.btn {
|
|
||||||
padding: 0.75rem 1.5rem;
|
|
||||||
border-radius: 0.5rem;
|
|
||||||
font-weight: 500;
|
|
||||||
transition: all 0.2s;
|
|
||||||
text-decoration: none;
|
|
||||||
display: inline-flex;
|
|
||||||
align-items: center;
|
|
||||||
gap: 0.5rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.btn-primary {
|
|
||||||
background: var(--primary);
|
|
||||||
color: white;
|
|
||||||
border: 2px solid var(--primary);
|
|
||||||
}
|
|
||||||
|
|
||||||
.btn-primary:hover {
|
|
||||||
background: var(--primary-hover);
|
|
||||||
transform: translateY(-2px);
|
|
||||||
}
|
|
||||||
|
|
||||||
.btn-secondary {
|
|
||||||
border: 2px solid #e2e8f0;
|
|
||||||
color: var(--text);
|
|
||||||
background: white;
|
|
||||||
}
|
|
||||||
|
|
||||||
.btn-secondary:hover {
|
|
||||||
border-color: #cbd5e1;
|
|
||||||
background: #f8fafc;
|
|
||||||
}
|
|
||||||
|
|
||||||
@keyframes float {
|
|
||||||
0%, 100% { transform: translateY(0); }
|
|
||||||
50% { transform: translateY(-20px); }
|
|
||||||
}
|
|
||||||
|
|
||||||
@media (max-width: 640px) {
|
|
||||||
.error-code {
|
|
||||||
font-size: 3rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
h1 {
|
|
||||||
font-size: 1.5rem;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
Before Width: | Height: | Size: 101 KiB |
|
Before Width: | Height: | Size: 34 KiB |
|
Before Width: | Height: | Size: 11 KiB |
|
Before Width: | Height: | Size: 15 KiB |
|
Before Width: | Height: | Size: 4.4 MiB |
@ -1,21 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "MyWebSite",
|
|
||||||
"short_name": "MySite",
|
|
||||||
"icons": [
|
|
||||||
{
|
|
||||||
"src": "/static/favicon/web-app-manifest-192x192.png",
|
|
||||||
"sizes": "192x192",
|
|
||||||
"type": "image/png",
|
|
||||||
"purpose": "maskable"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"src": "/static/favicon/web-app-manifest-512x512.png",
|
|
||||||
"sizes": "512x512",
|
|
||||||
"type": "image/png",
|
|
||||||
"purpose": "maskable"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"theme_color": "#ffffff",
|
|
||||||
"background_color": "#ffffff",
|
|
||||||
"display": "standalone"
|
|
||||||
}
|
|
||||||
|
Before Width: | Height: | Size: 38 KiB |
|
Before Width: | Height: | Size: 177 KiB |
|
Before Width: | Height: | Size: 386 KiB |
@ -1,104 +0,0 @@
|
|||||||
document.addEventListener('DOMContentLoaded', function () {
|
|
||||||
"use strict"; // Строгий режим
|
|
||||||
|
|
||||||
console.log("DOM загружен"); // Отладочное сообщение
|
|
||||||
|
|
||||||
// Инициализация Scrollspy
|
|
||||||
let scrollSpy = new bootstrap.ScrollSpy(document.body, {
|
|
||||||
target: '#page-nav',
|
|
||||||
smoothScroll: true
|
|
||||||
});
|
|
||||||
|
|
||||||
// Кнопка для мобильной навигации
|
|
||||||
const toggleNavButton = document.getElementById('toggle-nav');
|
|
||||||
const leftNav = document.getElementById('left-nav');
|
|
||||||
const rightNav = document.getElementById('right-nav');
|
|
||||||
|
|
||||||
console.log("toggleNavButton:", toggleNavButton); // Отладочное сообщение
|
|
||||||
console.log("leftNav:", leftNav); // Отладочное сообщение
|
|
||||||
console.log("rightNav:", rightNav); // Отладочное сообщение
|
|
||||||
|
|
||||||
if (toggleNavButton && leftNav && rightNav) {
|
|
||||||
toggleNavButton.addEventListener('click', function () {
|
|
||||||
console.log("Кнопка нажата"); // Отладочное сообщение
|
|
||||||
|
|
||||||
if (leftNav.classList.contains('d-none')) {
|
|
||||||
leftNav.classList.remove('d-none');
|
|
||||||
rightNav.classList.remove('d-none');
|
|
||||||
this.textContent = 'Скрыть навигацию';
|
|
||||||
} else {
|
|
||||||
leftNav.classList.add('d-none');
|
|
||||||
rightNav.classList.add('d-none');
|
|
||||||
this.textContent = 'Показать навигацию';
|
|
||||||
}
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
console.error("Один из элементов не найден"); // Отладочное сообщение
|
|
||||||
}
|
|
||||||
|
|
||||||
// Поиск по странице
|
|
||||||
const searchForm = document.getElementById('search-form');
|
|
||||||
const searchInput = document.getElementById('search-input');
|
|
||||||
|
|
||||||
if (searchForm && searchInput) {
|
|
||||||
searchForm.addEventListener('submit', function (event) {
|
|
||||||
event.preventDefault(); // Отменяем стандартное поведение формы
|
|
||||||
|
|
||||||
const searchQuery = searchInput.value.trim();
|
|
||||||
if (searchQuery === '') {
|
|
||||||
alert('Введите текст для поиска.');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Очищаем предыдущие выделения
|
|
||||||
clearHighlights();
|
|
||||||
|
|
||||||
// Ищем и выделяем текст
|
|
||||||
const pageContents = document.querySelectorAll('.page-content');
|
|
||||||
let found = false;
|
|
||||||
let firstHighlight = null; // Первое найденное выделение
|
|
||||||
|
|
||||||
pageContents.forEach(page => {
|
|
||||||
const contentElements = page.querySelectorAll('.content p'); // Ищем текст внутри <p>
|
|
||||||
contentElements.forEach(element => {
|
|
||||||
const text = element.textContent;
|
|
||||||
const regex = new RegExp(`(${searchQuery})`, 'gi'); // Регулярное выражение для поиска
|
|
||||||
const newText = text.replace(regex, '<span class="highlight">$1</span>'); // Заменяем найденное слово на выделенный текст
|
|
||||||
|
|
||||||
if (newText !== text) {
|
|
||||||
element.innerHTML = newText; // Обновляем содержимое элемента
|
|
||||||
found = true;
|
|
||||||
|
|
||||||
// Если это первое найденное выделение, сохраняем его
|
|
||||||
if (!firstHighlight) {
|
|
||||||
firstHighlight = element.querySelector('.highlight');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
// Прокрутка к первому найденному выделению
|
|
||||||
if (firstHighlight) {
|
|
||||||
firstHighlight.scrollIntoView({
|
|
||||||
behavior: 'smooth', // Плавная прокрутка
|
|
||||||
block: 'center' // Прокрутка к центру экрана
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!found) {
|
|
||||||
alert('Ничего не найдено.');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// Функция для очистки выделений
|
|
||||||
function clearHighlights() {
|
|
||||||
const highlights = document.querySelectorAll('.highlight');
|
|
||||||
highlights.forEach(highlight => {
|
|
||||||
const text = highlight.textContent;
|
|
||||||
highlight.replaceWith(text); // Убираем выделение
|
|
||||||
});
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
console.error("Форма поиска или поле ввода не найдены"); // Отладочное сообщение
|
|
||||||
}
|
|
||||||
});
|
|
||||||
@ -1,60 +0,0 @@
|
|||||||
/* Стили для модального окна */
|
|
||||||
#modal {
|
|
||||||
border: none;
|
|
||||||
border-radius: 10px;
|
|
||||||
padding: 20px;
|
|
||||||
width: 300px;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Заголовок модального окна */
|
|
||||||
.modal-header {
|
|
||||||
font-size: 18px;
|
|
||||||
font-weight: bold;
|
|
||||||
margin-bottom: 10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Метка */
|
|
||||||
.modal-label {
|
|
||||||
display: block;
|
|
||||||
font-size: 14px;
|
|
||||||
opacity: 0.6;
|
|
||||||
margin-bottom: 5px;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Поле ввода */
|
|
||||||
.modal-textarea {
|
|
||||||
width: 100%;
|
|
||||||
height: 80px;
|
|
||||||
border-radius: 8px;
|
|
||||||
border: 1px solid #ccc;
|
|
||||||
padding: 8px;
|
|
||||||
resize: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Подвал модального окна */
|
|
||||||
.modal-footer {
|
|
||||||
display: flex;
|
|
||||||
justify-content: space-between;
|
|
||||||
margin-top: 15px;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Общие стили для кнопок */
|
|
||||||
.modal-button {
|
|
||||||
border: none;
|
|
||||||
font-size: 14px;
|
|
||||||
cursor: pointer;
|
|
||||||
border-radius: 6px;
|
|
||||||
padding: 8px 12px;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Кнопка "Закрыть" */
|
|
||||||
.modal-button.close {
|
|
||||||
background: transparent;
|
|
||||||
color: #007bff;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Кнопка "Отправить" */
|
|
||||||
.modal-button.submit {
|
|
||||||
background-color: #007bff;
|
|
||||||
color: white;
|
|
||||||
}
|
|
||||||
@ -1,46 +0,0 @@
|
|||||||
.documents-container {
|
|
||||||
display: flex;
|
|
||||||
flex-wrap: wrap;
|
|
||||||
gap: 20px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.document-box {
|
|
||||||
border: 1px solid #ddd;
|
|
||||||
padding: 20px;
|
|
||||||
width: 200px;
|
|
||||||
background-color: #f9f9f9;
|
|
||||||
text-align: center;
|
|
||||||
border-radius: 8px;
|
|
||||||
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
|
|
||||||
}
|
|
||||||
|
|
||||||
.document-icon {
|
|
||||||
font-size: 40px;
|
|
||||||
color: #555;
|
|
||||||
margin-bottom: 10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.document-info {
|
|
||||||
font-size: 14px;
|
|
||||||
margin-bottom: 10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.download-link {
|
|
||||||
display: inline-block;
|
|
||||||
padding: 8px 15px;
|
|
||||||
background-color: #0A5BFF;
|
|
||||||
color: white;
|
|
||||||
text-decoration: none;
|
|
||||||
border-radius: 5px;
|
|
||||||
font-size: 14px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.download-link:hover {
|
|
||||||
background-color: #0341be;
|
|
||||||
}
|
|
||||||
|
|
||||||
.no-documents {
|
|
||||||
text-align: center;
|
|
||||||
font-size: 16px;
|
|
||||||
color: #777;
|
|
||||||
}
|
|
||||||
@ -1,119 +0,0 @@
|
|||||||
canvas {
|
|
||||||
width: 100% !important;
|
|
||||||
height: 100% !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
.title-box {
|
|
||||||
background: #DAE6FF;
|
|
||||||
/* padding: 15px 30px; */
|
|
||||||
border-radius: 10px;
|
|
||||||
color: #0A5BFF;
|
|
||||||
font-size: 48px;
|
|
||||||
font-weight: bold;
|
|
||||||
text-align: center;
|
|
||||||
max-width: 1000px;
|
|
||||||
width: 100%;
|
|
||||||
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
|
|
||||||
}
|
|
||||||
.main-container {
|
|
||||||
background-color: #F4F5F6;
|
|
||||||
display: flex;
|
|
||||||
/* flex-direction: column; */
|
|
||||||
gap: 20px;
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
.left-panel {
|
|
||||||
flex: 2;
|
|
||||||
background: #FFFFFF;
|
|
||||||
border-radius: 10px;
|
|
||||||
padding: 20px;
|
|
||||||
height: 500px;
|
|
||||||
min-width: 600px;
|
|
||||||
max-width: 700px;
|
|
||||||
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
|
|
||||||
}
|
|
||||||
.right-panel {
|
|
||||||
flex: 1;
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
gap: 20px;
|
|
||||||
max-width: 300px;
|
|
||||||
}
|
|
||||||
.left-panel, .right-panel {
|
|
||||||
overflow: hidden;
|
|
||||||
overflow: auto;
|
|
||||||
}
|
|
||||||
.small-box {
|
|
||||||
background: #FFFFFF;
|
|
||||||
border-radius: 10px;
|
|
||||||
padding: 20px;
|
|
||||||
height: 200px;
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
align-items: flex-start;
|
|
||||||
justify-content: flex-start;
|
|
||||||
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
.button-box {
|
|
||||||
background: #0A5BFF;
|
|
||||||
color: white;
|
|
||||||
text-align: center;
|
|
||||||
border-radius: 10px;
|
|
||||||
padding: 15px;
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
|
||||||
|
|
||||||
.button-box:hover{
|
|
||||||
background: #0952E6;
|
|
||||||
}
|
|
||||||
.label-container {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
gap: 10px;
|
|
||||||
}
|
|
||||||
.label-box {
|
|
||||||
background: #C5CCD4;
|
|
||||||
padding: 5px;
|
|
||||||
border-radius: 5px;
|
|
||||||
}
|
|
||||||
.report-box {
|
|
||||||
background: white;
|
|
||||||
display: flex;
|
|
||||||
border-radius: 10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.input-container {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
align-items: left;
|
|
||||||
gap: 1px;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
dialog {
|
|
||||||
width: 400px;
|
|
||||||
padding: 20px;
|
|
||||||
border-radius: 10px;
|
|
||||||
border: none;
|
|
||||||
box-shadow: 0px 5px 15px rgba(0,0,0,0.3);
|
|
||||||
}
|
|
||||||
.modal-header {
|
|
||||||
font-size: 18px;
|
|
||||||
font-weight: bold;
|
|
||||||
margin-bottom: 10px;
|
|
||||||
}
|
|
||||||
.modal-body {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
gap: 10px;
|
|
||||||
}
|
|
||||||
.modal-footer {
|
|
||||||
margin-top: 15px;
|
|
||||||
text-align: right;
|
|
||||||
}
|
|
||||||
.modal-footer button {
|
|
||||||
padding: 8px 15px;
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
|
||||||
@ -1,322 +0,0 @@
|
|||||||
/* Глобальные переменные */
|
|
||||||
:root {
|
|
||||||
--primary-color: #0d6efd;
|
|
||||||
--secondary-color: #6c757d;
|
|
||||||
--background-color: #f8f9fa;
|
|
||||||
--border-color: #dee2e6;
|
|
||||||
--text-color: #333;
|
|
||||||
--shadow-color: rgba(0, 0, 0, 0.1);
|
|
||||||
--gradient-primary: linear-gradient(135deg, #0d6efd, #0b5ed7);
|
|
||||||
--gradient-hover: linear-gradient(135deg, #0b5ed7, #0a58ca);
|
|
||||||
--navbar-height: 10px; /* Высота навбара */
|
|
||||||
--content-padding: 10px; /* Стандартный отступ для контента */
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Глобальные стили для body */
|
|
||||||
body {
|
|
||||||
font-family: Arial, sans-serif;
|
|
||||||
color: var(--text-color);
|
|
||||||
background-color: var(--background-color);
|
|
||||||
/*padding: var(--navbar-height);*/
|
|
||||||
/*margin: 0;*/
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
.navbar-brand {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
font-size: 1.25rem;
|
|
||||||
font-weight: bold;
|
|
||||||
color: var(--primary-color) !important;
|
|
||||||
transition: opacity 0.3s;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
.navbar-brand:hover {
|
|
||||||
opacity: 0.8;
|
|
||||||
}
|
|
||||||
|
|
||||||
.navbar-brand img {
|
|
||||||
border-radius: 8px;
|
|
||||||
transition: transform 0.3s;
|
|
||||||
}
|
|
||||||
|
|
||||||
.navbar-brand:hover img {
|
|
||||||
transform: scale(1.1);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Стили для кнопки выхода */
|
|
||||||
.btn-outline-danger {
|
|
||||||
border: 2px solid;
|
|
||||||
font-weight: 500;
|
|
||||||
transition: all 0.3s;
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.btn-outline-danger:hover {
|
|
||||||
background-color: #dc3545;
|
|
||||||
color: white !important;
|
|
||||||
transform: translateY(-2px);
|
|
||||||
}
|
|
||||||
|
|
||||||
.btn-outline-danger i {
|
|
||||||
margin-right: 8px;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* Анимации */
|
|
||||||
@keyframes fadeIn {
|
|
||||||
from {
|
|
||||||
opacity: 0;
|
|
||||||
transform: translateY(-20px);
|
|
||||||
}
|
|
||||||
to {
|
|
||||||
opacity: 1;
|
|
||||||
transform: translateY(0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Адаптивность */
|
|
||||||
@media (max-width: 768px) {
|
|
||||||
.navbar-brand {
|
|
||||||
font-size: 1rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.btn-outline-danger {
|
|
||||||
padding: 5px 10px;
|
|
||||||
font-size: 0.9rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.footer .text-muted {
|
|
||||||
font-size: 0.8rem;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/* Стили для карточек книг */
|
|
||||||
.card {
|
|
||||||
border: none;
|
|
||||||
border-radius: 12px;
|
|
||||||
overflow: hidden;
|
|
||||||
background-color: white;
|
|
||||||
box-shadow: 0 4px 12px var(--shadow-color);
|
|
||||||
transition: transform 0.3s, box-shadow 0.3s;
|
|
||||||
height: 100%;
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
scroll-margin-bottom: 100px;
|
|
||||||
}
|
|
||||||
.card-img-overlay {
|
|
||||||
position: absolute;
|
|
||||||
top: 0;
|
|
||||||
right: 0;
|
|
||||||
bottom: 0;
|
|
||||||
left: 0;
|
|
||||||
padding: 1rem;
|
|
||||||
display: flex;
|
|
||||||
justify-content: flex-end;
|
|
||||||
align-items: flex-start;
|
|
||||||
pointer-events: none; /* Позволяет кликать через иконки на карточке */
|
|
||||||
}
|
|
||||||
.card-img-overlay a {
|
|
||||||
pointer-events: auto; /* Возвращает возможность кликать по иконкам */
|
|
||||||
}
|
|
||||||
.card-img-overlay a i {
|
|
||||||
background-color: rgba(255, 255, 255, 0.7);
|
|
||||||
border-radius: 50%;
|
|
||||||
padding: 0.3rem;
|
|
||||||
margin-left: 0.5rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
.card:hover {
|
|
||||||
transform: translateY(-5px);
|
|
||||||
box-shadow: 0 8px 16px rgba(13, 110, 253, 0.3), 0 12px 24px rgba(13, 110, 253, 0.2) !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
.card-img-top {
|
|
||||||
height: 200px;
|
|
||||||
object-fit: cover;
|
|
||||||
border-bottom: 1px solid var(--border-color);
|
|
||||||
}
|
|
||||||
|
|
||||||
.card-body {
|
|
||||||
padding: 20px;
|
|
||||||
flex-grow: 1;
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
justify-content: space-between;
|
|
||||||
}
|
|
||||||
|
|
||||||
.card-title {
|
|
||||||
font-size: 1.25rem;
|
|
||||||
font-weight: 600;
|
|
||||||
margin-bottom: 10px;
|
|
||||||
color: var(--text-color);
|
|
||||||
}
|
|
||||||
|
|
||||||
.card-text {
|
|
||||||
font-size: 0.9rem;
|
|
||||||
color: var(--secondary-color);
|
|
||||||
margin-bottom: 15px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.card-link {
|
|
||||||
text-decoration: none;
|
|
||||||
color: inherit;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Стили для карточки "Добавить книгу" */
|
|
||||||
.card-add {
|
|
||||||
background-color: var(--background-color);
|
|
||||||
border: 2px dashed var(--border-color);
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
cursor: pointer;
|
|
||||||
transition: background-color 0.3s, border-color 0.3s, box-shadow 0.3s;
|
|
||||||
}
|
|
||||||
|
|
||||||
.card-add:hover {
|
|
||||||
background-color: #e9ecef;
|
|
||||||
border-color: var(--primary-color);
|
|
||||||
box-shadow: 0 8px 16px rgba(13, 110, 253, 0.3), 0 12px 24px rgba(13, 110, 253, 0.2); /* Синие тени */
|
|
||||||
}
|
|
||||||
|
|
||||||
.card-add .card-body {
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.card-add i {
|
|
||||||
font-size: 2rem;
|
|
||||||
color: var(--primary-color);
|
|
||||||
margin-bottom: 10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.card-add h5 {
|
|
||||||
font-size: 1.1rem;
|
|
||||||
color: var(--primary-color);
|
|
||||||
margin: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Стили для модального окна */
|
|
||||||
.modal-content {
|
|
||||||
border: none;
|
|
||||||
border-radius: 12px;
|
|
||||||
box-shadow: 0 4px 12px var(--shadow-color);
|
|
||||||
}
|
|
||||||
|
|
||||||
.modal-header {
|
|
||||||
background-color: var(--primary-color);
|
|
||||||
color: white;
|
|
||||||
border-top-left-radius: 12px;
|
|
||||||
border-top-right-radius: 12px;
|
|
||||||
padding: 15px 20px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.modal-title {
|
|
||||||
font-size: 1.25rem;
|
|
||||||
font-weight: 600;
|
|
||||||
}
|
|
||||||
|
|
||||||
.modal-body {
|
|
||||||
padding: 20px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.modal-footer {
|
|
||||||
border-top: 1px solid var(--border-color);
|
|
||||||
padding: 15px 20px;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Стили для формы */
|
|
||||||
.form-label {
|
|
||||||
font-weight: 500;
|
|
||||||
color: var(--text-color);
|
|
||||||
margin-bottom: 5px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.form-control {
|
|
||||||
border: 1px solid var(--border-color);
|
|
||||||
border-radius: 8px;
|
|
||||||
padding: 10px;
|
|
||||||
font-size: 0.9rem;
|
|
||||||
transition: border-color 0.3s, box-shadow 0.3s;
|
|
||||||
}
|
|
||||||
|
|
||||||
.form-control:focus {
|
|
||||||
border-color: var(--primary-color);
|
|
||||||
box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.25);
|
|
||||||
}
|
|
||||||
|
|
||||||
.form-select {
|
|
||||||
border: 1px solid var(--border-color);
|
|
||||||
border-radius: 8px;
|
|
||||||
padding: 10px;
|
|
||||||
font-size: 0.9rem;
|
|
||||||
transition: border-color 0.3s, box-shadow 0.3s;
|
|
||||||
}
|
|
||||||
|
|
||||||
.form-select:focus {
|
|
||||||
border-color: var(--primary-color);
|
|
||||||
box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.25);
|
|
||||||
}
|
|
||||||
|
|
||||||
.form-check-input {
|
|
||||||
margin-top: 0.3rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.form-check-label {
|
|
||||||
font-size: 0.9rem;
|
|
||||||
color: var(--text-color);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Стили для кнопок */
|
|
||||||
.btn-primary {
|
|
||||||
background: var(--gradient-primary);
|
|
||||||
border: none;
|
|
||||||
border-radius: 8px;
|
|
||||||
padding: 10px 20px;
|
|
||||||
font-size: 0.9rem;
|
|
||||||
font-weight: 500;
|
|
||||||
color: white;
|
|
||||||
transition: all 0.3s;
|
|
||||||
}
|
|
||||||
|
|
||||||
.btn-primary:hover {
|
|
||||||
background: var(--gradient-hover);
|
|
||||||
transform: translateY(-2px);
|
|
||||||
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
|
|
||||||
}
|
|
||||||
|
|
||||||
.btn-secondary {
|
|
||||||
background-color: var(--secondary-color);
|
|
||||||
border: none;
|
|
||||||
border-radius: 8px;
|
|
||||||
padding: 10px 20px;
|
|
||||||
font-size: 0.9rem;
|
|
||||||
font-weight: 500;
|
|
||||||
color: white;
|
|
||||||
transition: all 0.3s;
|
|
||||||
}
|
|
||||||
|
|
||||||
.btn-secondary:hover {
|
|
||||||
background-color: #5a6268;
|
|
||||||
transform: translateY(-2px);
|
|
||||||
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Стили для ошибок валидации */
|
|
||||||
.invalid-feedback {
|
|
||||||
font-size: 0.8rem;
|
|
||||||
color: #dc3545;
|
|
||||||
margin-top: 5px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.is-invalid {
|
|
||||||
border-color: #dc3545 !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
.is-invalid:focus {
|
|
||||||
box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.25) !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
@ -1,16 +0,0 @@
|
|||||||
from django.contrib import admin
|
|
||||||
from django.urls import path
|
|
||||||
import client_app.views as client_views
|
|
||||||
from django.contrib.auth.views import LogoutView
|
|
||||||
|
|
||||||
urlpatterns = [
|
|
||||||
path('admin/', admin.site.urls),
|
|
||||||
path('stats/', client_views.stats_page),
|
|
||||||
path('report/', client_views.report_page),
|
|
||||||
path('reason/', client_views.reason_page),
|
|
||||||
path('get_status/', client_views.get_status),
|
|
||||||
path("chart-data/", client_views.get_chart_data),
|
|
||||||
path("client_admin/", client_views.admin_client),
|
|
||||||
path('accounts/login/', client_views.CustomLoginView.as_view(), name='login'),
|
|
||||||
path('logout/', LogoutView.as_view(next_page='/accounts/login/'), name='logout'),
|
|
||||||
]
|
|
||||||
@ -1,247 +0,0 @@
|
|||||||
<#
|
|
||||||
.Synopsis
|
|
||||||
Activate a Python virtual environment for the current PowerShell session.
|
|
||||||
|
|
||||||
.Description
|
|
||||||
Pushes the python executable for a virtual environment to the front of the
|
|
||||||
$Env:PATH environment variable and sets the prompt to signify that you are
|
|
||||||
in a Python virtual environment. Makes use of the command line switches as
|
|
||||||
well as the `pyvenv.cfg` file values present in the virtual environment.
|
|
||||||
|
|
||||||
.Parameter VenvDir
|
|
||||||
Path to the directory that contains the virtual environment to activate. The
|
|
||||||
default value for this is the parent of the directory that the Activate.ps1
|
|
||||||
script is located within.
|
|
||||||
|
|
||||||
.Parameter Prompt
|
|
||||||
The prompt prefix to display when this virtual environment is activated. By
|
|
||||||
default, this prompt is the name of the virtual environment folder (VenvDir)
|
|
||||||
surrounded by parentheses and followed by a single space (ie. '(.venv) ').
|
|
||||||
|
|
||||||
.Example
|
|
||||||
Activate.ps1
|
|
||||||
Activates the Python virtual environment that contains the Activate.ps1 script.
|
|
||||||
|
|
||||||
.Example
|
|
||||||
Activate.ps1 -Verbose
|
|
||||||
Activates the Python virtual environment that contains the Activate.ps1 script,
|
|
||||||
and shows extra information about the activation as it executes.
|
|
||||||
|
|
||||||
.Example
|
|
||||||
Activate.ps1 -VenvDir C:\Users\MyUser\Common\.venv
|
|
||||||
Activates the Python virtual environment located in the specified location.
|
|
||||||
|
|
||||||
.Example
|
|
||||||
Activate.ps1 -Prompt "MyPython"
|
|
||||||
Activates the Python virtual environment that contains the Activate.ps1 script,
|
|
||||||
and prefixes the current prompt with the specified string (surrounded in
|
|
||||||
parentheses) while the virtual environment is active.
|
|
||||||
|
|
||||||
.Notes
|
|
||||||
On Windows, it may be required to enable this Activate.ps1 script by setting the
|
|
||||||
execution policy for the user. You can do this by issuing the following PowerShell
|
|
||||||
command:
|
|
||||||
|
|
||||||
PS C:\> Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
|
|
||||||
|
|
||||||
For more information on Execution Policies:
|
|
||||||
https://go.microsoft.com/fwlink/?LinkID=135170
|
|
||||||
|
|
||||||
#>
|
|
||||||
Param(
|
|
||||||
[Parameter(Mandatory = $false)]
|
|
||||||
[String]
|
|
||||||
$VenvDir,
|
|
||||||
[Parameter(Mandatory = $false)]
|
|
||||||
[String]
|
|
||||||
$Prompt
|
|
||||||
)
|
|
||||||
|
|
||||||
<# Function declarations --------------------------------------------------- #>
|
|
||||||
|
|
||||||
<#
|
|
||||||
.Synopsis
|
|
||||||
Remove all shell session elements added by the Activate script, including the
|
|
||||||
addition of the virtual environment's Python executable from the beginning of
|
|
||||||
the PATH variable.
|
|
||||||
|
|
||||||
.Parameter NonDestructive
|
|
||||||
If present, do not remove this function from the global namespace for the
|
|
||||||
session.
|
|
||||||
|
|
||||||
#>
|
|
||||||
function global:deactivate ([switch]$NonDestructive) {
|
|
||||||
# Revert to original values
|
|
||||||
|
|
||||||
# The prior prompt:
|
|
||||||
if (Test-Path -Path Function:_OLD_VIRTUAL_PROMPT) {
|
|
||||||
Copy-Item -Path Function:_OLD_VIRTUAL_PROMPT -Destination Function:prompt
|
|
||||||
Remove-Item -Path Function:_OLD_VIRTUAL_PROMPT
|
|
||||||
}
|
|
||||||
|
|
||||||
# The prior PYTHONHOME:
|
|
||||||
if (Test-Path -Path Env:_OLD_VIRTUAL_PYTHONHOME) {
|
|
||||||
Copy-Item -Path Env:_OLD_VIRTUAL_PYTHONHOME -Destination Env:PYTHONHOME
|
|
||||||
Remove-Item -Path Env:_OLD_VIRTUAL_PYTHONHOME
|
|
||||||
}
|
|
||||||
|
|
||||||
# The prior PATH:
|
|
||||||
if (Test-Path -Path Env:_OLD_VIRTUAL_PATH) {
|
|
||||||
Copy-Item -Path Env:_OLD_VIRTUAL_PATH -Destination Env:PATH
|
|
||||||
Remove-Item -Path Env:_OLD_VIRTUAL_PATH
|
|
||||||
}
|
|
||||||
|
|
||||||
# Just remove the VIRTUAL_ENV altogether:
|
|
||||||
if (Test-Path -Path Env:VIRTUAL_ENV) {
|
|
||||||
Remove-Item -Path env:VIRTUAL_ENV
|
|
||||||
}
|
|
||||||
|
|
||||||
# Just remove VIRTUAL_ENV_PROMPT altogether.
|
|
||||||
if (Test-Path -Path Env:VIRTUAL_ENV_PROMPT) {
|
|
||||||
Remove-Item -Path env:VIRTUAL_ENV_PROMPT
|
|
||||||
}
|
|
||||||
|
|
||||||
# Just remove the _PYTHON_VENV_PROMPT_PREFIX altogether:
|
|
||||||
if (Get-Variable -Name "_PYTHON_VENV_PROMPT_PREFIX" -ErrorAction SilentlyContinue) {
|
|
||||||
Remove-Variable -Name _PYTHON_VENV_PROMPT_PREFIX -Scope Global -Force
|
|
||||||
}
|
|
||||||
|
|
||||||
# Leave deactivate function in the global namespace if requested:
|
|
||||||
if (-not $NonDestructive) {
|
|
||||||
Remove-Item -Path function:deactivate
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
<#
|
|
||||||
.Description
|
|
||||||
Get-PyVenvConfig parses the values from the pyvenv.cfg file located in the
|
|
||||||
given folder, and returns them in a map.
|
|
||||||
|
|
||||||
For each line in the pyvenv.cfg file, if that line can be parsed into exactly
|
|
||||||
two strings separated by `=` (with any amount of whitespace surrounding the =)
|
|
||||||
then it is considered a `key = value` line. The left hand string is the key,
|
|
||||||
the right hand is the value.
|
|
||||||
|
|
||||||
If the value starts with a `'` or a `"` then the first and last character is
|
|
||||||
stripped from the value before being captured.
|
|
||||||
|
|
||||||
.Parameter ConfigDir
|
|
||||||
Path to the directory that contains the `pyvenv.cfg` file.
|
|
||||||
#>
|
|
||||||
function Get-PyVenvConfig(
|
|
||||||
[String]
|
|
||||||
$ConfigDir
|
|
||||||
) {
|
|
||||||
Write-Verbose "Given ConfigDir=$ConfigDir, obtain values in pyvenv.cfg"
|
|
||||||
|
|
||||||
# Ensure the file exists, and issue a warning if it doesn't (but still allow the function to continue).
|
|
||||||
$pyvenvConfigPath = Join-Path -Resolve -Path $ConfigDir -ChildPath 'pyvenv.cfg' -ErrorAction Continue
|
|
||||||
|
|
||||||
# An empty map will be returned if no config file is found.
|
|
||||||
$pyvenvConfig = @{ }
|
|
||||||
|
|
||||||
if ($pyvenvConfigPath) {
|
|
||||||
|
|
||||||
Write-Verbose "File exists, parse `key = value` lines"
|
|
||||||
$pyvenvConfigContent = Get-Content -Path $pyvenvConfigPath
|
|
||||||
|
|
||||||
$pyvenvConfigContent | ForEach-Object {
|
|
||||||
$keyval = $PSItem -split "\s*=\s*", 2
|
|
||||||
if ($keyval[0] -and $keyval[1]) {
|
|
||||||
$val = $keyval[1]
|
|
||||||
|
|
||||||
# Remove extraneous quotations around a string value.
|
|
||||||
if ("'""".Contains($val.Substring(0, 1))) {
|
|
||||||
$val = $val.Substring(1, $val.Length - 2)
|
|
||||||
}
|
|
||||||
|
|
||||||
$pyvenvConfig[$keyval[0]] = $val
|
|
||||||
Write-Verbose "Adding Key: '$($keyval[0])'='$val'"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return $pyvenvConfig
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
<# Begin Activate script --------------------------------------------------- #>
|
|
||||||
|
|
||||||
# Determine the containing directory of this script
|
|
||||||
$VenvExecPath = Split-Path -Parent $MyInvocation.MyCommand.Definition
|
|
||||||
$VenvExecDir = Get-Item -Path $VenvExecPath
|
|
||||||
|
|
||||||
Write-Verbose "Activation script is located in path: '$VenvExecPath'"
|
|
||||||
Write-Verbose "VenvExecDir Fullname: '$($VenvExecDir.FullName)"
|
|
||||||
Write-Verbose "VenvExecDir Name: '$($VenvExecDir.Name)"
|
|
||||||
|
|
||||||
# Set values required in priority: CmdLine, ConfigFile, Default
|
|
||||||
# First, get the location of the virtual environment, it might not be
|
|
||||||
# VenvExecDir if specified on the command line.
|
|
||||||
if ($VenvDir) {
|
|
||||||
Write-Verbose "VenvDir given as parameter, using '$VenvDir' to determine values"
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
Write-Verbose "VenvDir not given as a parameter, using parent directory name as VenvDir."
|
|
||||||
$VenvDir = $VenvExecDir.Parent.FullName.TrimEnd("\\/")
|
|
||||||
Write-Verbose "VenvDir=$VenvDir"
|
|
||||||
}
|
|
||||||
|
|
||||||
# Next, read the `pyvenv.cfg` file to determine any required value such
|
|
||||||
# as `prompt`.
|
|
||||||
$pyvenvCfg = Get-PyVenvConfig -ConfigDir $VenvDir
|
|
||||||
|
|
||||||
# Next, set the prompt from the command line, or the config file, or
|
|
||||||
# just use the name of the virtual environment folder.
|
|
||||||
if ($Prompt) {
|
|
||||||
Write-Verbose "Prompt specified as argument, using '$Prompt'"
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
Write-Verbose "Prompt not specified as argument to script, checking pyvenv.cfg value"
|
|
||||||
if ($pyvenvCfg -and $pyvenvCfg['prompt']) {
|
|
||||||
Write-Verbose " Setting based on value in pyvenv.cfg='$($pyvenvCfg['prompt'])'"
|
|
||||||
$Prompt = $pyvenvCfg['prompt'];
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
Write-Verbose " Setting prompt based on parent's directory's name. (Is the directory name passed to venv module when creating the virtual environment)"
|
|
||||||
Write-Verbose " Got leaf-name of $VenvDir='$(Split-Path -Path $venvDir -Leaf)'"
|
|
||||||
$Prompt = Split-Path -Path $venvDir -Leaf
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Write-Verbose "Prompt = '$Prompt'"
|
|
||||||
Write-Verbose "VenvDir='$VenvDir'"
|
|
||||||
|
|
||||||
# Deactivate any currently active virtual environment, but leave the
|
|
||||||
# deactivate function in place.
|
|
||||||
deactivate -nondestructive
|
|
||||||
|
|
||||||
# Now set the environment variable VIRTUAL_ENV, used by many tools to determine
|
|
||||||
# that there is an activated venv.
|
|
||||||
$env:VIRTUAL_ENV = $VenvDir
|
|
||||||
|
|
||||||
if (-not $Env:VIRTUAL_ENV_DISABLE_PROMPT) {
|
|
||||||
|
|
||||||
Write-Verbose "Setting prompt to '$Prompt'"
|
|
||||||
|
|
||||||
# Set the prompt to include the env name
|
|
||||||
# Make sure _OLD_VIRTUAL_PROMPT is global
|
|
||||||
function global:_OLD_VIRTUAL_PROMPT { "" }
|
|
||||||
Copy-Item -Path function:prompt -Destination function:_OLD_VIRTUAL_PROMPT
|
|
||||||
New-Variable -Name _PYTHON_VENV_PROMPT_PREFIX -Description "Python virtual environment prompt prefix" -Scope Global -Option ReadOnly -Visibility Public -Value $Prompt
|
|
||||||
|
|
||||||
function global:prompt {
|
|
||||||
Write-Host -NoNewline -ForegroundColor Green "($_PYTHON_VENV_PROMPT_PREFIX) "
|
|
||||||
_OLD_VIRTUAL_PROMPT
|
|
||||||
}
|
|
||||||
$env:VIRTUAL_ENV_PROMPT = $Prompt
|
|
||||||
}
|
|
||||||
|
|
||||||
# Clear PYTHONHOME
|
|
||||||
if (Test-Path -Path Env:PYTHONHOME) {
|
|
||||||
Copy-Item -Path Env:PYTHONHOME -Destination Env:_OLD_VIRTUAL_PYTHONHOME
|
|
||||||
Remove-Item -Path Env:PYTHONHOME
|
|
||||||
}
|
|
||||||
|
|
||||||
# Add the venv to the PATH
|
|
||||||
Copy-Item -Path Env:PATH -Destination Env:_OLD_VIRTUAL_PATH
|
|
||||||
$Env:PATH = "$VenvExecDir$([System.IO.Path]::PathSeparator)$Env:PATH"
|
|
||||||
@ -1,70 +0,0 @@
|
|||||||
# This file must be used with "source bin/activate" *from bash*
|
|
||||||
# You cannot run it directly
|
|
||||||
|
|
||||||
deactivate () {
|
|
||||||
# reset old environment variables
|
|
||||||
if [ -n "${_OLD_VIRTUAL_PATH:-}" ] ; then
|
|
||||||
PATH="${_OLD_VIRTUAL_PATH:-}"
|
|
||||||
export PATH
|
|
||||||
unset _OLD_VIRTUAL_PATH
|
|
||||||
fi
|
|
||||||
if [ -n "${_OLD_VIRTUAL_PYTHONHOME:-}" ] ; then
|
|
||||||
PYTHONHOME="${_OLD_VIRTUAL_PYTHONHOME:-}"
|
|
||||||
export PYTHONHOME
|
|
||||||
unset _OLD_VIRTUAL_PYTHONHOME
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Call hash to forget past commands. Without forgetting
|
|
||||||
# past commands the $PATH changes we made may not be respected
|
|
||||||
hash -r 2> /dev/null
|
|
||||||
|
|
||||||
if [ -n "${_OLD_VIRTUAL_PS1:-}" ] ; then
|
|
||||||
PS1="${_OLD_VIRTUAL_PS1:-}"
|
|
||||||
export PS1
|
|
||||||
unset _OLD_VIRTUAL_PS1
|
|
||||||
fi
|
|
||||||
|
|
||||||
unset VIRTUAL_ENV
|
|
||||||
unset VIRTUAL_ENV_PROMPT
|
|
||||||
if [ ! "${1:-}" = "nondestructive" ] ; then
|
|
||||||
# Self destruct!
|
|
||||||
unset -f deactivate
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
# unset irrelevant variables
|
|
||||||
deactivate nondestructive
|
|
||||||
|
|
||||||
# on Windows, a path can contain colons and backslashes and has to be converted:
|
|
||||||
if [ "${OSTYPE:-}" = "cygwin" ] || [ "${OSTYPE:-}" = "msys" ] ; then
|
|
||||||
# transform D:\path\to\venv to /d/path/to/venv on MSYS
|
|
||||||
# and to /cygdrive/d/path/to/venv on Cygwin
|
|
||||||
export VIRTUAL_ENV=$(cygpath /home/efim/project/zircon/tools/labelme)
|
|
||||||
else
|
|
||||||
# use the path as-is
|
|
||||||
export VIRTUAL_ENV=/home/efim/project/zircon/tools/labelme
|
|
||||||
fi
|
|
||||||
|
|
||||||
_OLD_VIRTUAL_PATH="$PATH"
|
|
||||||
PATH="$VIRTUAL_ENV/"bin":$PATH"
|
|
||||||
export PATH
|
|
||||||
|
|
||||||
# unset PYTHONHOME if set
|
|
||||||
# this will fail if PYTHONHOME is set to the empty string (which is bad anyway)
|
|
||||||
# could use `if (set -u; : $PYTHONHOME) ;` in bash
|
|
||||||
if [ -n "${PYTHONHOME:-}" ] ; then
|
|
||||||
_OLD_VIRTUAL_PYTHONHOME="${PYTHONHOME:-}"
|
|
||||||
unset PYTHONHOME
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -z "${VIRTUAL_ENV_DISABLE_PROMPT:-}" ] ; then
|
|
||||||
_OLD_VIRTUAL_PS1="${PS1:-}"
|
|
||||||
PS1='(labelme) '"${PS1:-}"
|
|
||||||
export PS1
|
|
||||||
VIRTUAL_ENV_PROMPT='(labelme) '
|
|
||||||
export VIRTUAL_ENV_PROMPT
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Call hash to forget past commands. Without forgetting
|
|
||||||
# past commands the $PATH changes we made may not be respected
|
|
||||||
hash -r 2> /dev/null
|
|
||||||
@ -1,27 +0,0 @@
|
|||||||
# This file must be used with "source bin/activate.csh" *from csh*.
|
|
||||||
# You cannot run it directly.
|
|
||||||
|
|
||||||
# Created by Davide Di Blasi <davidedb@gmail.com>.
|
|
||||||
# Ported to Python 3.3 venv by Andrew Svetlov <andrew.svetlov@gmail.com>
|
|
||||||
|
|
||||||
alias deactivate 'test $?_OLD_VIRTUAL_PATH != 0 && setenv PATH "$_OLD_VIRTUAL_PATH" && unset _OLD_VIRTUAL_PATH; rehash; test $?_OLD_VIRTUAL_PROMPT != 0 && set prompt="$_OLD_VIRTUAL_PROMPT" && unset _OLD_VIRTUAL_PROMPT; unsetenv VIRTUAL_ENV; unsetenv VIRTUAL_ENV_PROMPT; test "\!:*" != "nondestructive" && unalias deactivate'
|
|
||||||
|
|
||||||
# Unset irrelevant variables.
|
|
||||||
deactivate nondestructive
|
|
||||||
|
|
||||||
setenv VIRTUAL_ENV /home/efim/project/zircon/tools/labelme
|
|
||||||
|
|
||||||
set _OLD_VIRTUAL_PATH="$PATH"
|
|
||||||
setenv PATH "$VIRTUAL_ENV/"bin":$PATH"
|
|
||||||
|
|
||||||
|
|
||||||
set _OLD_VIRTUAL_PROMPT="$prompt"
|
|
||||||
|
|
||||||
if (! "$?VIRTUAL_ENV_DISABLE_PROMPT") then
|
|
||||||
set prompt = '(labelme) '"$prompt"
|
|
||||||
setenv VIRTUAL_ENV_PROMPT '(labelme) '
|
|
||||||
endif
|
|
||||||
|
|
||||||
alias pydoc python -m pydoc
|
|
||||||
|
|
||||||
rehash
|
|
||||||
@ -1,69 +0,0 @@
|
|||||||
# This file must be used with "source <venv>/bin/activate.fish" *from fish*
|
|
||||||
# (https://fishshell.com/). You cannot run it directly.
|
|
||||||
|
|
||||||
function deactivate -d "Exit virtual environment and return to normal shell environment"
|
|
||||||
# reset old environment variables
|
|
||||||
if test -n "$_OLD_VIRTUAL_PATH"
|
|
||||||
set -gx PATH $_OLD_VIRTUAL_PATH
|
|
||||||
set -e _OLD_VIRTUAL_PATH
|
|
||||||
end
|
|
||||||
if test -n "$_OLD_VIRTUAL_PYTHONHOME"
|
|
||||||
set -gx PYTHONHOME $_OLD_VIRTUAL_PYTHONHOME
|
|
||||||
set -e _OLD_VIRTUAL_PYTHONHOME
|
|
||||||
end
|
|
||||||
|
|
||||||
if test -n "$_OLD_FISH_PROMPT_OVERRIDE"
|
|
||||||
set -e _OLD_FISH_PROMPT_OVERRIDE
|
|
||||||
# prevents error when using nested fish instances (Issue #93858)
|
|
||||||
if functions -q _old_fish_prompt
|
|
||||||
functions -e fish_prompt
|
|
||||||
functions -c _old_fish_prompt fish_prompt
|
|
||||||
functions -e _old_fish_prompt
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
set -e VIRTUAL_ENV
|
|
||||||
set -e VIRTUAL_ENV_PROMPT
|
|
||||||
if test "$argv[1]" != "nondestructive"
|
|
||||||
# Self-destruct!
|
|
||||||
functions -e deactivate
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
# Unset irrelevant variables.
|
|
||||||
deactivate nondestructive
|
|
||||||
|
|
||||||
set -gx VIRTUAL_ENV /home/efim/project/zircon/tools/labelme
|
|
||||||
|
|
||||||
set -gx _OLD_VIRTUAL_PATH $PATH
|
|
||||||
set -gx PATH "$VIRTUAL_ENV/"bin $PATH
|
|
||||||
|
|
||||||
# Unset PYTHONHOME if set.
|
|
||||||
if set -q PYTHONHOME
|
|
||||||
set -gx _OLD_VIRTUAL_PYTHONHOME $PYTHONHOME
|
|
||||||
set -e PYTHONHOME
|
|
||||||
end
|
|
||||||
|
|
||||||
if test -z "$VIRTUAL_ENV_DISABLE_PROMPT"
|
|
||||||
# fish uses a function instead of an env var to generate the prompt.
|
|
||||||
|
|
||||||
# Save the current fish_prompt function as the function _old_fish_prompt.
|
|
||||||
functions -c fish_prompt _old_fish_prompt
|
|
||||||
|
|
||||||
# With the original prompt function renamed, we can override with our own.
|
|
||||||
function fish_prompt
|
|
||||||
# Save the return status of the last command.
|
|
||||||
set -l old_status $status
|
|
||||||
|
|
||||||
# Output the venv prompt; color taken from the blue of the Python logo.
|
|
||||||
printf "%s%s%s" (set_color 4B8BBE) '(labelme) ' (set_color normal)
|
|
||||||
|
|
||||||
# Restore the return status of the previous command.
|
|
||||||
echo "exit $old_status" | .
|
|
||||||
# Output the original/"old" prompt.
|
|
||||||
_old_fish_prompt
|
|
||||||
end
|
|
||||||
|
|
||||||
set -gx _OLD_FISH_PROMPT_OVERRIDE "$VIRTUAL_ENV"
|
|
||||||
set -gx VIRTUAL_ENV_PROMPT '(labelme) '
|
|
||||||
end
|
|
||||||
@ -1,8 +0,0 @@
|
|||||||
#!/home/efim/project/zircon/tools/labelme/bin/python3
|
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
import re
|
|
||||||
import sys
|
|
||||||
from coloredlogs.cli import main
|
|
||||||
if __name__ == '__main__':
|
|
||||||
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
|
||||||
sys.exit(main())
|
|
||||||
@ -1,8 +0,0 @@
|
|||||||
#!/home/efim/project/zircon/tools/labelme/bin/python3
|
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
import re
|
|
||||||
import sys
|
|
||||||
from numpy.f2py.f2py2e import main
|
|
||||||
if __name__ == '__main__':
|
|
||||||
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
|
||||||
sys.exit(main())
|
|
||||||
@ -1,8 +0,0 @@
|
|||||||
#!/home/efim/project/zircon/tools/labelme/bin/python3
|
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
import re
|
|
||||||
import sys
|
|
||||||
from fontTools.__main__ import main
|
|
||||||
if __name__ == '__main__':
|
|
||||||
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
|
||||||
sys.exit(main())
|
|
||||||
@ -1,8 +0,0 @@
|
|||||||
#!/home/efim/project/zircon/tools/labelme/bin/python3
|
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
import re
|
|
||||||
import sys
|
|
||||||
from gdown.__main__ import main
|
|
||||||
if __name__ == '__main__':
|
|
||||||
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
|
||||||
sys.exit(main())
|
|
||||||
@ -1,8 +0,0 @@
|
|||||||
#!/home/efim/project/zircon/tools/labelme/bin/python3
|
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
import re
|
|
||||||
import sys
|
|
||||||
from humanfriendly.cli import main
|
|
||||||
if __name__ == '__main__':
|
|
||||||
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
|
||||||
sys.exit(main())
|
|
||||||
@ -1,8 +0,0 @@
|
|||||||
#!/home/efim/project/zircon/tools/labelme/bin/python3
|
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
import re
|
|
||||||
import sys
|
|
||||||
from imageio.__main__ import download_bin_main
|
|
||||||
if __name__ == '__main__':
|
|
||||||
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
|
||||||
sys.exit(download_bin_main())
|
|
||||||
@ -1,8 +0,0 @@
|
|||||||
#!/home/efim/project/zircon/tools/labelme/bin/python3
|
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
import re
|
|
||||||
import sys
|
|
||||||
from imageio.__main__ import remove_bin_main
|
|
||||||
if __name__ == '__main__':
|
|
||||||
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
|
||||||
sys.exit(remove_bin_main())
|
|
||||||
@ -1,8 +0,0 @@
|
|||||||
#!/home/efim/project/zircon/tools/labelme/bin/python3
|
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
import re
|
|
||||||
import sys
|
|
||||||
from isympy import main
|
|
||||||
if __name__ == '__main__':
|
|
||||||
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
|
||||||
sys.exit(main())
|
|
||||||
@ -1,8 +0,0 @@
|
|||||||
#!/home/efim/project/zircon/tools/labelme/bin/python3
|
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
import re
|
|
||||||
import sys
|
|
||||||
from labelme.__main__ import main
|
|
||||||
if __name__ == '__main__':
|
|
||||||
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
|
||||||
sys.exit(main())
|
|
||||||
@ -1,8 +0,0 @@
|
|||||||
#!/home/efim/project/zircon/tools/labelme/bin/python3
|
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
import re
|
|
||||||
import sys
|
|
||||||
from labelme.cli.draw_json import main
|
|
||||||
if __name__ == '__main__':
|
|
||||||
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
|
||||||
sys.exit(main())
|
|
||||||
@ -1,8 +0,0 @@
|
|||||||
#!/home/efim/project/zircon/tools/labelme/bin/python3
|
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
import re
|
|
||||||
import sys
|
|
||||||
from labelme.cli.draw_label_png import main
|
|
||||||
if __name__ == '__main__':
|
|
||||||
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
|
||||||
sys.exit(main())
|
|
||||||
@ -1,8 +0,0 @@
|
|||||||
#!/home/efim/project/zircon/tools/labelme/bin/python3
|
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
import re
|
|
||||||
import sys
|
|
||||||
from labelme.cli.export_json import main
|
|
||||||
if __name__ == '__main__':
|
|
||||||
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
|
||||||
sys.exit(main())
|
|
||||||
@ -1,8 +0,0 @@
|
|||||||
#!/home/efim/project/zircon/tools/labelme/bin/python3
|
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
import re
|
|
||||||
import sys
|
|
||||||
from labelme.cli.json_to_dataset import main
|
|
||||||
if __name__ == '__main__':
|
|
||||||
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
|
||||||
sys.exit(main())
|
|
||||||
@ -1,8 +0,0 @@
|
|||||||
#!/home/efim/project/zircon/tools/labelme/bin/python3
|
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
import re
|
|
||||||
import sys
|
|
||||||
from labelme.cli.on_docker import main
|
|
||||||
if __name__ == '__main__':
|
|
||||||
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
|
||||||
sys.exit(main())
|
|
||||||
@ -1,8 +0,0 @@
|
|||||||
#!/home/efim/project/zircon/tools/labelme/bin/python3
|
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
import re
|
|
||||||
import sys
|
|
||||||
from tifffile.lsm2bin import main
|
|
||||||
if __name__ == '__main__':
|
|
||||||
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
|
||||||
sys.exit(main())
|
|
||||||
@ -1,8 +0,0 @@
|
|||||||
#!/home/efim/project/zircon/tools/labelme/bin/python3
|
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
import re
|
|
||||||
import sys
|
|
||||||
from natsort.__main__ import main
|
|
||||||
if __name__ == '__main__':
|
|
||||||
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
|
||||||
sys.exit(main())
|
|
||||||
@ -1,8 +0,0 @@
|
|||||||
#!/home/efim/project/zircon/tools/labelme/bin/python3
|
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
import re
|
|
||||||
import sys
|
|
||||||
from charset_normalizer import cli
|
|
||||||
if __name__ == '__main__':
|
|
||||||
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
|
||||||
sys.exit(cli.cli_detect())
|
|
||||||
@ -1,8 +0,0 @@
|
|||||||
#!/home/efim/project/zircon/tools/labelme/bin/python3
|
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
import re
|
|
||||||
import sys
|
|
||||||
from numpy._configtool import main
|
|
||||||
if __name__ == '__main__':
|
|
||||||
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
|
||||||
sys.exit(main())
|
|
||||||
@ -1,8 +0,0 @@
|
|||||||
#!/home/efim/project/zircon/tools/labelme/bin/python3
|
|
||||||
# -*- coding: utf-8 -*-
|
|
||||||
import re
|
|
||||||
import sys
|
|
||||||
from onnxruntime.tools.onnxruntime_test import main
|
|
||||||
if __name__ == '__main__':
|
|
||||||
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
|
|
||||||
sys.exit(main())
|
|
||||||