Commit 7a240e95 刘韬

1

1 个父辈 b3b114b3
正在显示 83 个修改的文件 包含 804 行增加85 行删除
# This file must be used with "source bin/activate" *from bash*
# you cannot run it directly
if [ "${BASH_SOURCE-}" = "$0" ]; then
echo "You must source this script: \$ source $0" >&2
exit 33
fi
deactivate () {
unset -f pydoc >/dev/null 2>&1 || true
# reset old environment variables
# ! [ -z ${VAR+_} ] returns true if VAR is declared at all
if ! [ -z "${_OLD_VIRTUAL_PATH:+_}" ] ; then
PATH="$_OLD_VIRTUAL_PATH"
export PATH
unset _OLD_VIRTUAL_PATH
fi
if ! [ -z "${_OLD_VIRTUAL_PYTHONHOME+_}" ] ; then
PYTHONHOME="$_OLD_VIRTUAL_PYTHONHOME"
export PYTHONHOME
unset _OLD_VIRTUAL_PYTHONHOME
fi
# The hash command must be called to get it to forget past
# commands. Without forgetting past commands the $PATH changes
# we made may not be respected
hash -r 2>/dev/null
if ! [ -z "${_OLD_VIRTUAL_PS1+_}" ] ; then
PS1="$_OLD_VIRTUAL_PS1"
export PS1
unset _OLD_VIRTUAL_PS1
fi
unset VIRTUAL_ENV
if [ ! "${1-}" = "nondestructive" ] ; then
# Self destruct!
unset -f deactivate
fi
}
# unset irrelevant variables
deactivate nondestructive
VIRTUAL_ENV='D:\rick\python\induction_shelf'
if ([ "$OSTYPE" = "cygwin" ] || [ "$OSTYPE" = "msys" ]) && $(command -v cygpath &> /dev/null) ; then
VIRTUAL_ENV=$(cygpath -u "$VIRTUAL_ENV")
fi
export VIRTUAL_ENV
_OLD_VIRTUAL_PATH="$PATH"
PATH="$VIRTUAL_ENV/Scripts:$PATH"
export PATH
# unset PYTHONHOME if set
if ! [ -z "${PYTHONHOME+_}" ] ; then
_OLD_VIRTUAL_PYTHONHOME="$PYTHONHOME"
unset PYTHONHOME
fi
if [ -z "${VIRTUAL_ENV_DISABLE_PROMPT-}" ] ; then
_OLD_VIRTUAL_PS1="${PS1-}"
if [ "x" != x ] ; then
PS1="() ${PS1-}"
else
PS1="(`basename \"$VIRTUAL_ENV\"`) ${PS1-}"
fi
export PS1
fi
# Make sure to unalias pydoc if it's already there
alias pydoc 2>/dev/null >/dev/null && unalias pydoc || true
pydoc () {
python -m pydoc "$@"
}
# The hash command must be called to get it to forget past
# commands. Without forgetting past commands the $PATH changes
# we made may not be respected
hash -r 2>/dev/null
@echo off
set "VIRTUAL_ENV=D:\rick\python\induction_shelf"
if defined _OLD_VIRTUAL_PROMPT (
set "PROMPT=%_OLD_VIRTUAL_PROMPT%"
) else (
if not defined PROMPT (
set "PROMPT=$P$G"
)
if not defined VIRTUAL_ENV_DISABLE_PROMPT (
set "_OLD_VIRTUAL_PROMPT=%PROMPT%"
)
)
if not defined VIRTUAL_ENV_DISABLE_PROMPT (
if "" NEQ "" (
set "PROMPT=() %PROMPT%"
) else (
for %%d in ("%VIRTUAL_ENV%") do set "PROMPT=(%%~nxd) %PROMPT%"
)
)
REM Don't use () to avoid problems with them in %PATH%
if defined _OLD_VIRTUAL_PYTHONHOME goto ENDIFVHOME
set "_OLD_VIRTUAL_PYTHONHOME=%PYTHONHOME%"
:ENDIFVHOME
set PYTHONHOME=
REM if defined _OLD_VIRTUAL_PATH (
if not defined _OLD_VIRTUAL_PATH goto ENDIFVPATH1
set "PATH=%_OLD_VIRTUAL_PATH%"
:ENDIFVPATH1
REM ) else (
if defined _OLD_VIRTUAL_PATH goto ENDIFVPATH2
set "_OLD_VIRTUAL_PATH=%PATH%"
:ENDIFVPATH2
set "PATH=%VIRTUAL_ENV%\Scripts;%PATH%"
# This file must be used using `source bin/activate.fish` *within a running fish ( http://fishshell.com ) session*.
# Do not run it directly.
function _bashify_path -d "Converts a fish path to something bash can recognize"
set fishy_path $argv
set bashy_path $fishy_path[1]
for path_part in $fishy_path[2..-1]
set bashy_path "$bashy_path:$path_part"
end
echo $bashy_path
end
function _fishify_path -d "Converts a bash path to something fish can recognize"
echo $argv | tr ':' '\n'
end
function deactivate -d 'Exit virtualenv mode and return to the normal environment.'
# reset old environment variables
if test -n "$_OLD_VIRTUAL_PATH"
# https://github.com/fish-shell/fish-shell/issues/436 altered PATH handling
if test (echo $FISH_VERSION | head -c 1) -lt 3
set -gx PATH (_fishify_path "$_OLD_VIRTUAL_PATH")
else
set -gx PATH $_OLD_VIRTUAL_PATH
end
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"
and functions -q _old_fish_prompt
# Set an empty local `$fish_function_path` to allow the removal of `fish_prompt` using `functions -e`.
set -l fish_function_path
# Erase virtualenv's `fish_prompt` and restore the original.
functions -e fish_prompt
functions -c _old_fish_prompt fish_prompt
functions -e _old_fish_prompt
set -e _OLD_FISH_PROMPT_OVERRIDE
end
set -e VIRTUAL_ENV
if test "$argv[1]" != 'nondestructive'
# Self-destruct!
functions -e pydoc
functions -e deactivate
functions -e _bashify_path
functions -e _fishify_path
end
end
# Unset irrelevant variables.
deactivate nondestructive
set -gx VIRTUAL_ENV 'D:\rick\python\induction_shelf'
# https://github.com/fish-shell/fish-shell/issues/436 altered PATH handling
if test (echo $FISH_VERSION | head -c 1) -lt 3
set -gx _OLD_VIRTUAL_PATH (_bashify_path $PATH)
else
set -gx _OLD_VIRTUAL_PATH $PATH
end
set -gx PATH "$VIRTUAL_ENV"'/Scripts' $PATH
# Unset `$PYTHONHOME` if set.
if set -q PYTHONHOME
set -gx _OLD_VIRTUAL_PYTHONHOME $PYTHONHOME
set -e PYTHONHOME
end
function pydoc
python -m pydoc $argv
end
if test -z "$VIRTUAL_ENV_DISABLE_PROMPT"
# Copy the current `fish_prompt` function as `_old_fish_prompt`.
functions -c fish_prompt _old_fish_prompt
function fish_prompt
# Run the user's prompt first; it might depend on (pipe)status.
set -l prompt (_old_fish_prompt)
# Prompt override provided?
# If not, just prepend the environment name.
if test -n ''
printf '(%s) ' ''
else
printf '(%s) ' (basename "$VIRTUAL_ENV")
end
string join -- \n $prompt # handle multi-line prompts
end
set -gx _OLD_FISH_PROMPT_OVERRIDE "$VIRTUAL_ENV"
end
# Setting all environment variables for the venv
let path-name = (if ((sys).host.name == "Windows") { "Path" } { "PATH" })
let virtual-env = "D:\rick\python\induction_shelf"
let bin = "Scripts"
let path-sep = ";"
let old-path = ($nu.path | str collect ($path-sep))
let venv-path = ([$virtual-env $bin] | path join)
let new-path = ($nu.path | prepend $venv-path | str collect ($path-sep))
# environment variables that will be batched loaded to the virtual env
let new-env = ([
[name, value];
[$path-name $new-path]
[_OLD_VIRTUAL_PATH $old-path]
[VIRTUAL_ENV $virtual-env]
])
load-env $new-env
# Creating the new prompt for the session
let virtual_prompt = (if ("" != "") {
"() "
} {
(build-string '(' ($virtual-env | path basename) ') ')
}
)
# If there is no default prompt, then only the env is printed in the prompt
let new_prompt = (if ( config | select prompt | empty? ) {
($"build-string '($virtual_prompt)'")
} {
($"build-string '($virtual_prompt)' (config get prompt | str find-replace "build-string" "")")
})
let-env PROMPT_COMMAND = $new_prompt
# We are using alias as the function definitions because only aliases can be
# removed from the scope
alias pydoc = python -m pydoc
alias deactivate = source "D:\rick\python\induction_shelf\Scripts\deactivate.nu"
$script:THIS_PATH = $myinvocation.mycommand.path
$script:BASE_DIR = Split-Path (Resolve-Path "$THIS_PATH/..") -Parent
function global:deactivate([switch] $NonDestructive) {
if (Test-Path variable:_OLD_VIRTUAL_PATH) {
$env:PATH = $variable:_OLD_VIRTUAL_PATH
Remove-Variable "_OLD_VIRTUAL_PATH" -Scope global
}
if (Test-Path function:_old_virtual_prompt) {
$function:prompt = $function:_old_virtual_prompt
Remove-Item function:\_old_virtual_prompt
}
if ($env:VIRTUAL_ENV) {
Remove-Item env:VIRTUAL_ENV -ErrorAction SilentlyContinue
}
if (!$NonDestructive) {
# Self destruct!
Remove-Item function:deactivate
Remove-Item function:pydoc
}
}
function global:pydoc {
python -m pydoc $args
}
# unset irrelevant variables
deactivate -nondestructive
$VIRTUAL_ENV = $BASE_DIR
$env:VIRTUAL_ENV = $VIRTUAL_ENV
New-Variable -Scope global -Name _OLD_VIRTUAL_PATH -Value $env:PATH
$env:PATH = "$env:VIRTUAL_ENV/Scripts;" + $env:PATH
if (!$env:VIRTUAL_ENV_DISABLE_PROMPT) {
function global:_old_virtual_prompt {
""
}
$function:_old_virtual_prompt = $function:prompt
if ("" -ne "") {
function global:prompt {
# Add the custom prefix to the existing prompt
$previous_prompt_value = & $function:_old_virtual_prompt
("() " + $previous_prompt_value)
}
}
else {
function global:prompt {
# Add a prefix to the current prompt, but don't discard it.
$previous_prompt_value = & $function:_old_virtual_prompt
$new_prompt_value = "($( Split-Path $env:VIRTUAL_ENV -Leaf )) "
($new_prompt_value + $previous_prompt_value)
}
}
}
# -*- coding: utf-8 -*-
"""Activate virtualenv for current interpreter:
Use exec(open(this_file).read(), {'__file__': this_file}).
This can be used when you must use an existing Python interpreter, not the virtualenv bin/python.
"""
import os
import site
import sys
try:
abs_file = os.path.abspath(__file__)
except NameError:
raise AssertionError("You must use exec(open(this_file).read(), {'__file__': this_file}))")
bin_dir = os.path.dirname(abs_file)
base = bin_dir[: -len("Scripts") - 1] # strip away the bin part from the __file__, plus the path separator
# prepend bin to PATH (this file is inside the bin directory)
os.environ["PATH"] = os.pathsep.join([bin_dir] + os.environ.get("PATH", "").split(os.pathsep))
os.environ["VIRTUAL_ENV"] = base # virtual env is right above bin directory
# add the virtual environments libraries to the host python import mechanism
prev_length = len(sys.path)
for lib in "..\Lib\site-packages".split(os.pathsep):
path = os.path.realpath(os.path.join(bin_dir, lib))
site.addsitedir(path.decode("utf-8") if "" else path)
sys.path[:] = sys.path[prev_length:] + sys.path[0:prev_length]
sys.real_prefix = sys.prefix
sys.prefix = base
@echo off
set VIRTUAL_ENV=
REM Don't use () to avoid problems with them in %PATH%
if not defined _OLD_VIRTUAL_PROMPT goto ENDIFVPROMPT
set "PROMPT=%_OLD_VIRTUAL_PROMPT%"
set _OLD_VIRTUAL_PROMPT=
:ENDIFVPROMPT
if not defined _OLD_VIRTUAL_PYTHONHOME goto ENDIFVHOME
set "PYTHONHOME=%_OLD_VIRTUAL_PYTHONHOME%"
set _OLD_VIRTUAL_PYTHONHOME=
:ENDIFVHOME
if not defined _OLD_VIRTUAL_PATH goto ENDIFVPATH
set "PATH=%_OLD_VIRTUAL_PATH%"
set _OLD_VIRTUAL_PATH=
:ENDIFVPATH
# Setting the old path
let path-name = (if ((sys).host.name == "Windows") { "Path" } { "PATH" })
let-env $path-name = $nu.env._OLD_VIRTUAL_PATH
# Unleting the environment variables that were created when activating the env
unlet-env VIRTUAL_ENV
unlet-env _OLD_VIRTUAL_PATH
unlet-env PROMPT_COMMAND
unalias pydoc
unalias deactivate
此文件类型无法预览
此文件类型无法预览
此文件类型无法预览
此文件类型无法预览
此文件类型无法预览
此文件类型无法预览
此文件类型无法预览
此文件类型无法预览
此文件类型无法预览
此文件类型无法预览
此文件类型无法预览
python.exe -m pydoc %*
此文件类型无法预览
此文件类型无法预览
此文件类型无法预览
此文件类型无法预览
此文件类型无法预览
此文件类型无法预览
此文件类型无法预览
此文件类型无法预览
此文件类型无法预览
此文件类型无法预览
此文件类型无法预览
此文件类型无法预览
home = C:\Program Files\Python310
implementation = CPython
version_info = 3.10.2.final.0
virtualenv = 20.13.2
include-system-site-packages = false
base-prefix = C:\Program Files\Python310
base-exec-prefix = C:\Program Files\Python310
base-executable = C:\Program Files\Python310\python.exe
.\" Manpage for qr
.TH QR 1 "1 Oct 2021" "7.3.1" "Python QR tool"
.SH NAME
qr \- script to create QR codes at the command line
.SH SYNOPSIS
qr [\-\-help] [\-\-factory=FACTORY] [\-\-optimize=OPTIMIZE] [\-\-error\-correction=LEVEL] [data]
.SH DESCRIPTION
This script uses the python qrcode module. It can take data from stdin or from the commandline and generate a QR code.
Normally it will output the QR code as ascii art to the terminal. If the output is piped to a file, it will output the image (default type of PNG).
.SH OPTIONS
.PP
\fB\ \-h, \-\-help\fR
.RS 4
Show a help message.
.RE
.PP
\fB\ \-\-factory=FACTORY\fR
.RS 4
Full python path to the image factory class to create the
image with. You can use the following shortcuts to the
built-in image factory classes: pil (default), pymaging,
svg, svg-fragment, svg-path.
.RE
.PP
\fB\ \-\-optimize=OPTIMIZE\fR
.RS 4
Optimize the data by looking for chunks of at least this
many characters that could use a more efficient encoding
method. Use 0 to turn off chunk optimization.
.RE
.PP
\fB\ \-\-error\-correction=LEVEL\fR
.RS 4
The error correction level to use. Choices are L (7%),
M (15%, default), Q (25%), and H (30%).
.RE
.PP
\fB\ data\fR
.RS 4
The data from which the QR code will be generated.
.RE
.SH SEE ALSO
https://github.com/lincolnloop/python-qrcode/
.Dd May 18, 2004
.\" ttx is not specific to any OS, but contrary to what groff_mdoc(7)
.\" seems to imply, entirely omitting the .Os macro causes 'BSD' to
.\" be used, so I give a zero-width space as its argument.
.Os \&
.\" The "FontTools Manual" argument apparently has no effect in
.\" groff 1.18.1. I think it is a bug in the -mdoc groff package.
.Dt TTX 1 "FontTools Manual"
.Sh NAME
.Nm ttx
.Nd tool for manipulating TrueType and OpenType fonts
.Sh SYNOPSIS
.Nm
.Bk
.Op Ar option ...
.Ek
.Bk
.Ar file ...
.Ek
.Sh DESCRIPTION
.Nm
is a tool for manipulating TrueType and OpenType fonts. It can convert
TrueType and OpenType fonts to and from an
.Tn XML Ns -based format called
.Tn TTX .
.Tn TTX
files have a
.Ql .ttx
extension.
.Pp
For each
.Ar file
argument it is given,
.Nm
detects whether it is a
.Ql .ttf ,
.Ql .otf
or
.Ql .ttx
file and acts accordingly: if it is a
.Ql .ttf
or
.Ql .otf
file, it generates a
.Ql .ttx
file; if it is a
.Ql .ttx
file, it generates a
.Ql .ttf
or
.Ql .otf
file.
.Pp
By default, every output file is created in the same directory as the
corresponding input file and with the same name except for the
extension, which is substituted appropriately.
.Nm
never overwrites existing files; if necessary, it appends a suffix to
the output file name before the extension, as in
.Pa Arial#1.ttf .
.Ss "General options"
.Bl -tag -width ".Fl t Ar table"
.It Fl h
Display usage information.
.It Fl d Ar dir
Write the output files to directory
.Ar dir
instead of writing every output file to the same directory as the
corresponding input file.
.It Fl o Ar file
Write the output to
.Ar file
instead of writing it to the same directory as the
corresponding input file.
.It Fl v
Be verbose. Write more messages to the standard output describing what
is being done.
.It Fl a
Allow virtual glyphs ID's on compile or decompile.
.El
.Ss "Dump options"
The following options control the process of dumping font files
(TrueType or OpenType) to
.Tn TTX
files.
.Bl -tag -width ".Fl t Ar table"
.It Fl l
List table information. Instead of dumping the font to a
.Tn TTX
file, display minimal information about each table.
.It Fl t Ar table
Dump table
.Ar table .
This option may be given multiple times to dump several tables at
once. When not specified, all tables are dumped.
.It Fl x Ar table
Exclude table
.Ar table
from the list of tables to dump. This option may be given multiple
times to exclude several tables from the dump. The
.Fl t
and
.Fl x
options are mutually exclusive.
.It Fl s
Split tables. Dump each table to a separate
.Tn TTX
file and write (under the name that would have been used for the output
file if the
.Fl s
option had not been given) one small
.Tn TTX
file containing references to the individual table dump files. This
file can be used as input to
.Nm
as long as the referenced files can be found in the same directory.
.It Fl i
.\" XXX: I suppose OpenType programs (exist and) are also affected.
Don't disassemble TrueType instructions. When this option is specified,
all TrueType programs (glyph programs, the font program and the
pre-program) are written to the
.Tn TTX
file as hexadecimal data instead of
assembly. This saves some time and results in smaller
.Tn TTX
files.
.It Fl y Ar n
When decompiling a TrueType Collection (TTC) file,
decompile font number
.Ar n ,
starting from 0.
.El
.Ss "Compilation options"
The following options control the process of compiling
.Tn TTX
files into font files (TrueType or OpenType):
.Bl -tag -width ".Fl t Ar table"
.It Fl m Ar fontfile
Merge the input
.Tn TTX
file
.Ar file
with
.Ar fontfile .
No more than one
.Ar file
argument can be specified when this option is used.
.It Fl b
Don't recalculate glyph bounding boxes. Use the values in the
.Tn TTX
file as is.
.El
.Sh "THE TTX FILE FORMAT"
You can find some information about the
.Tn TTX
file format in
.Pa documentation.html .
In particular, you will find in that file the list of tables understood by
.Nm
and the relations between TrueType GlyphIDs and the glyph names used in
.Tn TTX
files.
.Sh EXAMPLES
In the following examples, all files are read from and written to the
current directory. Additionally, the name given for the output file
assumes in every case that it did not exist before
.Nm
was invoked.
.Pp
Dump the TrueType font contained in
.Pa FreeSans.ttf
to
.Pa FreeSans.ttx :
.Pp
.Dl ttx FreeSans.ttf
.Pp
Compile
.Pa MyFont.ttx
into a TrueType or OpenType font file:
.Pp
.Dl ttx MyFont.ttx
.Pp
List the tables in
.Pa FreeSans.ttf
along with some information:
.Pp
.Dl ttx -l FreeSans.ttf
.Pp
Dump the
.Sq cmap
table from
.Pa FreeSans.ttf
to
.Pa FreeSans.ttx :
.Pp
.Dl ttx -t cmap FreeSans.ttf
.Sh NOTES
On MS\-Windows and MacOS,
.Nm
is available as a graphical application to which files can be dropped.
.Sh SEE ALSO
.Pa documentation.html
.Pp
.Xr fontforge 1 ,
.Xr ftinfo 1 ,
.Xr gfontview 1 ,
.Xr xmbdfed 1 ,
.Xr Font::TTF 3pm
.Sh AUTHORS
.Nm
was written by
.An -nosplit
.An "Just van Rossum" Aq just@letterror.com .
.Pp
This manual page was written by
.An "Florent Rougon" Aq f.rougon@free.fr
for the Debian GNU/Linux system based on the existing FontTools
documentation. It may be freely used, modified and distributed without
restrictions.
.\" For Emacs:
.\" Local Variables:
.\" fill-column: 72
.\" sentence-end: "[.?!][]\"')}]*\\($\\| $\\| \\| \\)[ \n]*"
.\" sentence-end-double-space: t
.\" End:
\ No newline at end of file \ No newline at end of file
...@@ -15,9 +15,9 @@ ...@@ -15,9 +15,9 @@
}, },
"args": [ "args": [
"run", "run",
"--host=0.0.0.0", "--host=0.0.0.0"
"--no-debugger", ,"--no-debugger"
"--no-reload" ,"--no-reload"
], ],
"jinja": true "jinja": true
} }
......
...@@ -5,9 +5,12 @@ from flask_babel import Babel ...@@ -5,9 +5,12 @@ from flask_babel import Babel
from config import Config from config import Config
import logging import logging
from logging.handlers import RotatingFileHandler,TimedRotatingFileHandler from logging.handlers import RotatingFileHandler,TimedRotatingFileHandler
#from flask_cors import CORS
global Serl
Serl=None
# from flask_socketio import SocketIO global aaa
aaa="123"
def setup_log(): def setup_log():
# 设置日志的记录等级 # 设置日志的记录等级
logging.basicConfig(level=Config.LOG_LEVEL) # 调试debug级 logging.basicConfig(level=Config.LOG_LEVEL) # 调试debug级
...@@ -21,10 +24,10 @@ def setup_log(): ...@@ -21,10 +24,10 @@ def setup_log():
# 为全局的日志工具对象(flask app使用的)添加日志记录器 # 为全局的日志工具对象(flask app使用的)添加日志记录器
logging.getLogger().addHandler(file_log_handler) logging.getLogger().addHandler(file_log_handler)
Serl=None
setup_log() setup_log()
app = Flask(__name__) app = Flask(__name__)
#CORS(app, resources=r'/*')
babel = Babel(app) babel = Babel(app)
app.config.from_object(Config) app.config.from_object(Config)
...@@ -35,13 +38,15 @@ LANGUAGES = { ...@@ -35,13 +38,15 @@ LANGUAGES = {
} }
from app import induction_post,induction_test,induction_admin,induction_config,autoback,qr_code,scan_collection from app import induction_post,induction_test,induction_admin,induction_config,autoback,qr_code,scan_collection
from app.induction_config import testCidExists
import time import time
def s(): def s():
data = {'key1':'value1','key2':'value2'} data = {'key1':'value1','key2':'value2'}
time.sleep(2) time.sleep(2)
requests.post("http://127.0.0.1:5000/stoppost",data) requests.post("http://127.0.0.1:5000/stoppost",data)
time.sleep(2) if testCidExists():
requests.post("http://127.0.0.1:5000/startpost",data) time.sleep(2)
requests.post("http://127.0.0.1:5000/startpost",data)
t =threading.Thread(target=s) t =threading.Thread(target=s)
t.start() t.start()
......
...@@ -31,9 +31,18 @@ ss16mm[] = {1,---100} ...@@ -31,9 +31,18 @@ ss16mm[] = {1,---100}
{"ADDR":"99","setcalibrate":[1,100,600,150],"threshold":45} {"ADDR":"99","setcalibrate":[1,100,600,150],"threshold":45}
{"ADDR":"99","calibrate":"min","threshold":45} {"ADDR":"99","calibrate":"min","threshold":45}
{"ADDR":"99","setcalibrate":"max","threshold":45} {"ADDR":"99","setcalibrate":"max","threshold":30}
{"ADDR":"99","calibrate":"autotrain"}
{"ADDR":"1","ledtype":[1,1,1,1,1]} {"ADDR":"1","ledtype":[1,1,1,1,1]}
{"ADDR":"99","action":"siteid","hwid":"FFFFFFF","addr":1} {"ADDR":"99","action":"siteid","hwid":"7cdfa117818","addr":2}
{"ADDR":"99","action":"info"}
{"ADDR":"99","action":"report"}
{"ADDR":"99","action":"LedBoardTest"}
{"ADDR":"99","action":"CheckList"}
{"ADDR":"99","action":"ClearCheckList"}
{"ADDR":"99","action":"PrintStatus"}
{"ADDR":"99","action":"factoryModeON"}
{"ADDR":"99","action":"ShelfPart","name":"NLP-00035-82-466-01"}
version 0.3 0708 version 0.3 0708
scan command:"A1\nA2\nA3\n" //for example this command means scan addr 1,2,3 and return 1,2 and 3 location status scan command:"A1\nA2\nA3\n" //for example this command means scan addr 1,2,3 and return 1,2 and 3 location status
...@@ -72,7 +81,7 @@ turn on/off all leds:"{"ADDR":"1","colorset":[[1,255,255,255]]}\n{"ADDR":"1","le ...@@ -72,7 +81,7 @@ turn on/off all leds:"{"ADDR":"1","colorset":[[1,255,255,255]]}\n{"ADDR":"1","le
{"ADDR":"1","calibrate":"min"} {"ADDR":"1","calibrate":"min"}
{"ADDR":"1","calibrate":"max"} {"ADDR":"1","calibrate":"max"}
{"ADDR":"1","setcalibrate":[1,100,0,1,20]}
......
# codinf:utf-8 # codinf:utf-8
from warnings import catch_warnings
from flask import request from flask import request
from app import app from app import app
import json import json
...@@ -9,6 +10,7 @@ import pexpect ...@@ -9,6 +10,7 @@ import pexpect
import os import os
import csv import csv
import logging import logging
import requests
from config import Config from config import Config
from werkzeug.utils import secure_filename from werkzeug.utils import secure_filename
from app.utils.serial_communication import SerialCommunication from app.utils.serial_communication import SerialCommunication
...@@ -37,6 +39,7 @@ def getstate(): ...@@ -37,6 +39,7 @@ def getstate():
serial_state=ser.check_serial() serial_state=ser.check_serial()
# serial_cf = ReadConfig() # serial_cf = ReadConfig()
addrs = read_addrs() addrs = read_addrs()
addrs=re.sub('A1(\d)',r'B\1',addrs)
serial_num = read_com() serial_num = read_com()
ad_serial = "串口号:{},地址:{}".format(serial_num,addrs) ad_serial = "串口号:{},地址:{}".format(serial_num,addrs)
c_dict = { c_dict = {
...@@ -105,7 +108,7 @@ def confirm_autostart(): ...@@ -105,7 +108,7 @@ def confirm_autostart():
result = re.findall(r"\b(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\b", ip_config['ip']) result = re.findall(r"\b(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\b", ip_config['ip'])
if result: if result:
ip = result[0] ip = result[0]
server_add = "http://{}/neotel".format(ip) server_add = "http://{}/smf".format(ip)
else: else:
server_add = "127.0.0.1:5000" server_add = "127.0.0.1:5000"
line1 = "Comment = star chrome and enter the website for \"{}\"".format(server_add) line1 = "Comment = star chrome and enter the website for \"{}\"".format(server_add)
...@@ -120,7 +123,7 @@ def confirm_autostart(): ...@@ -120,7 +123,7 @@ def confirm_autostart():
cmd = "chmod 777 " + filename cmd = "chmod 777 " + filename
run = pexpect.spawn('su -c "%s" root' %cmd) run = pexpect.spawn('su -c "%s" root' %cmd)
time.sleep(0.5) time.sleep(0.5)
run.sendline('xxx') run.sendline('123')
time.sleep(0.1) time.sleep(0.1)
with open("/home/pi/.config/autostart/auto.desktop","a") as f: with open("/home/pi/.config/autostart/auto.desktop","a") as f:
for i in strs: for i in strs:
...@@ -131,7 +134,7 @@ def confirm_autostart(): ...@@ -131,7 +134,7 @@ def confirm_autostart():
cmd = "chmod 777 " + filename cmd = "chmod 777 " + filename
run = pexpect.spawn('su -c "%s" root' %cmd) run = pexpect.spawn('su -c "%s" root' %cmd)
time.sleep(0.5) time.sleep(0.5)
run.sendline('xxx') run.sendline('123')
time.sleep(0.1) time.sleep(0.1)
with open("/home/pi/.config/autostart/auto.desktop","a") as f: with open("/home/pi/.config/autostart/auto.desktop","a") as f:
for i in strs: for i in strs:
...@@ -170,7 +173,7 @@ def upload_file(): ...@@ -170,7 +173,7 @@ def upload_file():
# reload_config() # reload_config()
return '{"filename":"%s"}' % filename return '{"filename":"%s"}' % filename
return True return True
import re
# 更新串口以及地址配置 # 更新串口以及地址配置
@app.route('/update_serial', methods=['POST']) @app.route('/update_serial', methods=['POST'])
def update_serial(): def update_serial():
...@@ -186,6 +189,7 @@ def update_serial(): ...@@ -186,6 +189,7 @@ def update_serial():
confirm_addrs(data['addrs']) confirm_addrs(data['addrs'])
serial_num = read_com() serial_num = read_com()
addrs = read_addrs() addrs = read_addrs()
addrs=re.sub('A1(\d)',r'B\1',addrs)
ad_serial = "串口号:{},地址:{}".format(serial_num,addrs) ad_serial = "串口号:{},地址:{}".format(serial_num,addrs)
return json.dumps({"addr":ad_serial}) return json.dumps({"addr":ad_serial})
...@@ -199,6 +203,12 @@ def read_addrs(): ...@@ -199,6 +203,12 @@ def read_addrs():
uploads_path = basepath + Config.STATE_PATH uploads_path = basepath + Config.STATE_PATH
with open(uploads_path + "addrs.txt","r") as f: with open(uploads_path + "addrs.txt","r") as f:
addrs=f.readline() addrs=f.readline()
addrs=addrs.replace('B','A1')
addrs=addrs.replace('b','A1')
#for addr in addrs:
# if addr.upper().startswith('B'):
# addr='A1'+addr[1:]
return addrs return addrs
def confirm_com(state): def confirm_com(state):
...@@ -239,7 +249,7 @@ def sendcolor(): ...@@ -239,7 +249,7 @@ def sendcolor():
# color_lists = [color_list[i:i+2] for i in range(0,len(color_list),2)] # color_lists = [color_list[i:i+2] for i in range(0,len(color_list),2)]
addrs = read_addrs() addrs = read_addrs()
addrs_string=addrs.split('@') addrs_string=addrs.split('@')
addr_list = filter(None,list(map(remove_a,addrs))) addr_list = filter(None,list(map(remove_a,addrs_string)))
for saddr in addr_list: for saddr in addr_list:
# for dlist in color_lists: # for dlist in color_lists:
colorset_dict = {"ADDR":saddr,"colorset":color_list} colorset_dict = {"ADDR":saddr,"colorset":color_list}
...@@ -277,4 +287,21 @@ def get_towerstate(): ...@@ -277,4 +287,21 @@ def get_towerstate():
# '5':{'action':False,'status':'off'}, # '5':{'action':False,'status':'off'},
# '6':{'action':True,'status':'on'} # '6':{'action':True,'status':'on'}
} }
return tower_state
\ No newline at end of file \ No newline at end of file
return tower_state
def testCidExists():
cid = ip_config['cid']
testurl = ip_config['ip'] + '/service/store/cidIsExists'
data = {"cid":cid}
try:
response = requests.get(testurl, params=data,timeout=2)
if response.status_code is not 200:
return None
response=response.json()
except Exception as e:
return None
if response['okResult']:
return True
else:
return False
\ No newline at end of file \ No newline at end of file
...@@ -464,6 +464,8 @@ def show_blink(): ...@@ -464,6 +464,8 @@ def show_blink():
blink_status = {'side':'both','status':False} blink_status = {'side':'both','status':False}
ng_status = {'side':'both','status':False} ng_status = {'side':'both','status':False}
blink_leds = {} blink_leds = {}
#locations = {'addr': 'A1', 'led_index': 1, 'sensor_index': 1, 'in_blink': False, 'out_blink': False, 'inloc_ng': False, 'outloc_ng': False, 'color': 'off', 'blink': False, 'blink_num': 0, 'action': False}
#locnum = S10392-A1-001
for locnum,locvalue in locations.items(): for locnum,locvalue in locations.items():
action_value = check_pre(locvalue) action_value = check_pre(locvalue)
locside='both' locside='both'
......
...@@ -70,7 +70,7 @@ msgstr "" ...@@ -70,7 +70,7 @@ msgstr ""
#: templates/induction_config.html:131 templates/induction_config.html:196 #: templates/induction_config.html:131 templates/induction_config.html:196
#: templates/induction_control.html:95 #: templates/induction_control.html:95
msgid "料架号" msgid "料架序列号"
msgstr "" msgstr ""
#: templates/induction_config.html:135 templates/induction_config.html:152 #: templates/induction_config.html:135 templates/induction_config.html:152
......
...@@ -29,27 +29,29 @@ def production_filter(origin_value): ...@@ -29,27 +29,29 @@ def production_filter(origin_value):
return cur_dict return cur_dict
def transfer(origin_value): def transfer(origin_value):
cur_dict = {} cur_dict = {}
if origin_value: if origin_value:
# receive_data=origin_value.split("\n") # receive_data=origin_value.split("\n")
receive_data=origin_value.decode().split("\r\n") receive_data=origin_value.decode().split("\r\n")
for item in receive_data[::-1]: for item in receive_data[::-1]:
if not (item.startswith("A") and item.endswith("]")): if not (item.startswith("A") and item.endswith("]")):
receive_data.remove(item) receive_data.remove(item)
print (item) print (item)
print("筛选后的数据:", receive_data) print("筛选后的数据:", receive_data)
if receive_data: if receive_data:
for line in receive_data: for line in receive_data:
# print ("-----------------line",line) # print ("-----------------line",line)
addr = re.search("(?<=A)\d+",line) addr = re.search("(?<=A)\d+",line)
led = re.search("\[.*?\]", line) led = re.search("\[.*?\]", line)
c_list = list(led.group()) if led is None:
continue
c_list = list(led.group())
# print ("-------------------c_list",c_list) # print ("-------------------c_list",c_list)
c_list.pop(0) c_list.pop(0)
c_list.pop(-1) c_list.pop(-1)
keyword = 'A' + addr.group() keyword = 'A' + addr.group()
cur_dict[keyword] = c_list cur_dict[keyword] = c_list
return cur_dict return cur_dict
def change_deatil(old_dict): def change_deatil(old_dict):
global s_detail global s_detail
......
A1
\ No newline at end of file \ No newline at end of file
A1@A2@B1
\ No newline at end of file \ No newline at end of file
http://192.168.1.243/smf-core,4
\ No newline at end of file \ No newline at end of file
http://192.168.1.243/smf-core,S10392
......
on
\ No newline at end of file \ No newline at end of file
off
\ No newline at end of file \ No newline at end of file
1.2
\ No newline at end of file \ No newline at end of file
1.5
\ No newline at end of file \ No newline at end of file
...@@ -126,10 +126,10 @@ ...@@ -126,10 +126,10 @@
<input type="text" class="form-control" id="ip" placeholder="请填入服务器地址"/> <input type="text" class="form-control" id="ip" placeholder="请填入服务器地址"/>
</div> </div>
<br> <br>
<!-- <label for="cha1" class="col-sm-3">料架号</label> --> <!-- <label for="cha1" class="col-sm-3">料架序列号</label> -->
<div class="input-group"> <div class="input-group">
<span class="input-group-addon">{{ _('料架号') }}:</span> <span class="input-group-addon">{{ _('料架序列号') }}:</span>
<input type="text" class="form-control" id="cid" placeholder="请填入料架号"/> <input type="text" class="form-control" id="cid" placeholder="请填入料架序列号"/>
</div> </div>
<br> <br>
<input type="button" value={{ _('保存') }} class="btn btn-info" onclick="updateip()"/> <input type="button" value={{ _('保存') }} class="btn btn-info" onclick="updateip()"/>
...@@ -148,7 +148,7 @@ ...@@ -148,7 +148,7 @@
<div class="col-sm-3"> <div class="col-sm-3">
<input id="addrs"> <input id="addrs">
</div> </div>
<div class="col-sm-4"> <div class="col-sm-3">
<input type="button" value={{ _('保存') }} class="btn btn-warning" onclick="updateserial()"/> <input type="button" value={{ _('保存') }} class="btn btn-warning" onclick="updateserial()"/>
<input type="button" value={{ _('同步颜色信息') }} class="btn btn-info" onclick="sendcolor()"/> <input type="button" value={{ _('同步颜色信息') }} class="btn btn-info" onclick="sendcolor()"/>
...@@ -193,7 +193,7 @@ ...@@ -193,7 +193,7 @@
</div> </div>
<div class="alert alert-info" role="alert"> <div class="alert alert-info" role="alert">
<p> <p>
{{ _('料架号') }}:<span id="ccid"></span> {{ _('料架序列号') }}:<span id="ccid"></span>
</p> </p>
</div> </div>
<div class="alert alert-info" role="alert"> <div class="alert alert-info" role="alert">
......
...@@ -92,7 +92,7 @@ ...@@ -92,7 +92,7 @@
</div> </div>
<div class="alert alert-info" role="alert"> <div class="alert alert-info" role="alert">
<p> <p>
{{ _('料架号') }}:<span id="ccid"></span> {{ _('料架序列号') }}:<span id="ccid"></span>
</p> </p>
</div> </div>
<!-- <div class="alert alert-info" role="alert"> <!-- <div class="alert alert-info" role="alert">
......
...@@ -81,20 +81,24 @@ ...@@ -81,20 +81,24 @@
<label for="cha" class="col-sm-1">{{ _('地址') }}</label> <label for="cha" class="col-sm-1">{{ _('地址') }}</label>
<div class="col-sm-3"> <div class="col-sm-3">
<select id='addrs' class="form-control"> <select id='addrs' class="form-control">
<option>1</option> <option>A1</option>
<option>2</option> <option>A2</option>
<option>3</option> <option>A3</option>
<option>4</option> <option>A4</option>
<option>5</option> <option>A5</option>
<option>6</option> <option>A6</option>
<option>7</option> <option>A7</option>
<option>8</option> <option>A8</option>
<option>9</option> <option>A9</option>
<option>10</option> <option>B1</option>
<option>11</option> <option>B2</option>
<option>12</option> <option>B3</option>
<option>13</option> <option>B4</option>
<option>14</option> <option>B5</option>
<option>B6</option>
<option>B7</option>
<option>B8</option>
<option>B9</option>
<option>all</option> <option>all</option>
</select> </select>
</div><!-- /.col-sm-4 --> </div><!-- /.col-sm-4 -->
...@@ -265,7 +269,10 @@ ...@@ -265,7 +269,10 @@
var shelfstate = document.getElementById("shelfstate").innerHTML var shelfstate = document.getElementById("shelfstate").innerHTML
if (shelfstate == '运行中') {alert("料架运行中,请关闭后再进行测试") if (shelfstate == '运行中') {alert("料架运行中,请关闭后再进行测试")
}else { }else {
var data = {"channel_num":document.getElementById("addrs").value, var addrs= document.getElementById("addrs").value;
addrs=addrs.replace('B','A1');
addrs=addrs.replace('A','');
var data = {"channel_num":addrs,
"channel_color":document.getElementById("linecolor").value} "channel_color":document.getElementById("linecolor").value}
console.log(data) console.log(data)
$.ajax({ $.ajax({
...@@ -387,7 +394,7 @@ ...@@ -387,7 +394,7 @@
if (shelfstate == '运行中') {alert("料架运行中,请关闭后再进行测试") if (shelfstate == '运行中') {alert("料架运行中,请关闭后再进行测试")
} else { } else {
var data = { var data = {
"workchannel":document.getElementById("workchannel").value, "workchannel":'16',
"command":'workoff'} "command":'workoff'}
$.ajax({ $.ajax({
url:"/indworkingoff", url:"/indworkingoff",
......
此文件类型无法预览
...@@ -71,7 +71,7 @@ msgstr "server address" ...@@ -71,7 +71,7 @@ msgstr "server address"
#: templates/induction_config.html:131 templates/induction_config.html:196 #: templates/induction_config.html:131 templates/induction_config.html:196
#: templates/induction_control.html:95 #: templates/induction_control.html:95
msgid "料架号" msgid "料架序列号"
msgstr "rack number" msgstr "rack number"
#: templates/induction_config.html:135 templates/induction_config.html:152 #: templates/induction_config.html:135 templates/induction_config.html:152
......
class g(): Serl = None
def __init__(self):
self.seal=None
@property
def name(self):
return self.seal
@name.setter
def name(self, value):
self.seal = value
\ No newline at end of file \ No newline at end of file
...@@ -23,6 +23,7 @@ class Location(): ...@@ -23,6 +23,7 @@ class Location():
head = next(reader) head = next(reader)
# lines = f.readlines()[1:] # lines = f.readlines()[1:]
for row in reader: for row in reader:
row[1]=row[1].replace('B','A1')
config_dict[row[0]] = row[2]+'@'+row[1]+'@'+row[3] config_dict[row[0]] = row[2]+'@'+row[1]+'@'+row[3]
convert_dict[row[3]+'@'+row[1]] = row[2]+'@'+row[1]+'@'+row[0] convert_dict[row[3]+'@'+row[1]] = row[2]+'@'+row[1]+'@'+row[0]
# led_addr_dict[row[2]+'@'+row[1]] = row[0]+'@'+row[3] # led_addr_dict[row[2]+'@'+row[1]] = row[0]+'@'+row[3]
......
...@@ -6,15 +6,15 @@ ...@@ -6,15 +6,15 @@
''' '''
import imp import imp
import serial import serial
import serial.tools.list_ports #import serial.tools.list_ports
import logging import logging
from config import Config from config import Config
serl = None import app.utils.g as gg
# from serial_config import ReadConfig #serl = None
# from app.induction_config import read_com
class SerialCommunication(): class SerialCommunication():
def __init__(self): def __init__(self):
global serl print(gg.Serl)
#global serl
# serial_cf = ReadConfig() # serial_cf = ReadConfig()
# self.port = serial_cf.get_serial("DEFAULT_COM") # self.port = serial_cf.get_serial("DEFAULT_COM")
# self.bps = int(serial_cf.get_serial("DEFAULT_BAUDRATE")) # self.bps = int(serial_cf.get_serial("DEFAULT_BAUDRATE"))
...@@ -26,16 +26,16 @@ class SerialCommunication(): ...@@ -26,16 +26,16 @@ class SerialCommunication():
self.port = serialcom.strip("\n") self.port = serialcom.strip("\n")
self.bps = 115200 self.bps = 115200
self.timeout = 1 self.timeout = 1
if serl is None: if gg.Serl is None:
try: try:
# 打开串口,并得到串口对象 # 打开串口,并得到串口对象
serl = serial.Serial(port=self.port,baudrate=self.bps,timeout=self.timeout) gg.Serl = serial.Serial(port=self.port,baudrate=self.bps,timeout=self.timeout)
# 判断是否打开成功 # 判断是否打开成功
# if (self.main_engine.is_open): # if (self.main_engine.is_open):
# print ("串口已打开") print ("串口已打开1")
except Exception as e: except Exception as e:
print("---异常---:", e) print("---异常---:", e)
self.main_engine=serl self.main_engine=gg.Serl
# 打印设备基本信息 # 打印设备基本信息
def print_name(self): def print_name(self):
...@@ -94,6 +94,10 @@ class SerialCommunication(): ...@@ -94,6 +94,10 @@ class SerialCommunication():
line = self.main_engine.readline().decode('utf-8').rstrip() line = self.main_engine.readline().decode('utf-8').rstrip()
return line return line
def read_Lines(self):
line = self.main_engine.readlines()
return line
def read_alldata(self): def read_alldata(self):
if self.main_engine.in_waiting: if self.main_engine.in_waiting:
return self.main_engine.read_all() return self.main_engine.read_all()
...@@ -105,7 +109,10 @@ class SerialCommunication(): ...@@ -105,7 +109,10 @@ class SerialCommunication():
#发数据 #发数据
def send_data(self,data): def send_data(self,data):
#self.main_engine.flushInput()
#self.main_engine.flushOutput()
# text = '{"ADDR":"99","colorset:[[1,255,0,0],[2,0,255,255],[5,132,142,110]]}\n{"ADDR":"1","color":[[1,10,20,30],[2,31,37,49],[5,1,3,5,7,9,11,14,18]]}\n{"ADDR":"3","color":[[1,10,20,30],[2,31,37,49],[5,1,3,5,7,9,11,14,18]]}\n' # text = '{"ADDR":"99","colorset:[[1,255,0,0],[2,0,255,255],[5,132,142,110]]}\n{"ADDR":"1","color":[[1,10,20,30],[2,31,37,49],[5,1,3,5,7,9,11,14,18]]}\n{"ADDR":"3","color":[[1,10,20,30],[2,31,37,49],[5,1,3,5,7,9,11,14,18]]}\n'
print('send_data:'+data)
data = bytes(data.encode('utf-8')) data = bytes(data.encode('utf-8'))
self.main_engine.write(data) self.main_engine.write(data)
......
...@@ -25,7 +25,7 @@ class ServerCommunication(): ...@@ -25,7 +25,7 @@ class ServerCommunication():
def server_post(body): def server_post(body):
ip_config = self.ip_config ip_config = self.ip_config
url = ip_config['ip'] + url = ip_config['ip']
cid = ip_config['cid'] cid = ip_config['cid']
headers = {'content-type': "application/json"} headers = {'content-type': "application/json"}
try: try:
......
此文件的差异太大,无法显示。
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!