Repository: incubator-senssoft-userale-pyqt5 Updated Branches: refs/heads/master f6f2b687f -> deca3e9f5
Added Apache license headers, reworked versioning, and Dockerfile Project: http://git-wip-us.apache.org/repos/asf/incubator-senssoft-userale-pyqt5/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-senssoft-userale-pyqt5/commit/95e2e056 Tree: http://git-wip-us.apache.org/repos/asf/incubator-senssoft-userale-pyqt5/tree/95e2e056 Diff: http://git-wip-us.apache.org/repos/asf/incubator-senssoft-userale-pyqt5/diff/95e2e056 Branch: refs/heads/master Commit: 95e2e056eb4c89ba1f7ba97639437f643aa1dfaf Parents: f6f2b68 Author: mooshu1x2 <mbe...@draper.com> Authored: Thu Sep 8 14:45:18 2016 -0400 Committer: mooshu1x2 <mbe...@draper.com> Committed: Thu Sep 8 14:45:18 2016 -0400 ---------------------------------------------------------------------- AUTHORS.rst | 15 ++ CHANGELOG.rst | 45 ++++-- CONTRIBUTING.rst | 15 ++ Dockerfile | 33 ++++ LICENSE | 58 +++++++ NOTICE | 5 + README.rst | 15 ++ docs/Makefile | 15 ++ docs/make.bat | 15 ++ docs/source/authors.rst | 15 ++ docs/source/changelog.rst | 15 ++ docs/source/conf.py | 15 ++ docs/source/contents.rst.inc | 15 ++ docs/source/contributing.rst | 15 ++ docs/source/index.rst | 15 ++ docs/source/installation.rst | 15 ++ docs/source/license.rst | 28 +++- docs/source/quickstart.rst | 15 ++ docs/source/userale.rst | 15 ++ requirements.txt | 15 +- setup.cfg | 15 ++ setup.py | 16 +- userale/__init__.py | 15 +- userale/ale.py | 147 +++++++++-------- userale/examples/__init__.py | 14 ++ userale/examples/testapp.py | 17 +- userale/examples/testclose.py | 15 ++ userale/examples/testdragndrop.py | 20 ++- userale/examples/testdragndrop2.py | 17 +- userale/examples/testwindowflags.py | 261 +++++++++++++++++++++++++++++++ userale/format.py | 17 +- userale/version.py | 15 +- 32 files changed, 832 insertions(+), 131 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-senssoft-userale-pyqt5/blob/95e2e056/AUTHORS.rst ---------------------------------------------------------------------- diff --git a/AUTHORS.rst b/AUTHORS.rst index 360f092..424072d 100644 --- a/AUTHORS.rst +++ b/AUTHORS.rst @@ -1,3 +1,18 @@ +<!--Licensed to the Apache Software Foundation (ASF) under one or more +contributor license agreements. See the NOTICE file distributed with +this work for additional information regarding copyright ownership. +The ASF licenses this file to You under the Apache License, Version 2.0 +(the "License"); you may not use this file except in compliance with +the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. --> + .. _authors: UserAle.pyqt5 is written and maintained by Draper and various contributors: http://git-wip-us.apache.org/repos/asf/incubator-senssoft-userale-pyqt5/blob/95e2e056/CHANGELOG.rst ---------------------------------------------------------------------- diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 1fe6500..a3ff1bb 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1,40 +1,63 @@ +<!--Licensed to the Apache Software Foundation (ASF) under one or more +contributor license agreements. See the NOTICE file distributed with +this work for additional information regarding copyright ownership. +The ASF licenses this file to You under the Apache License, Version 2.0 +(the "License"); you may not use this file except in compliance with +the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. --> + .. _changelog: Changelog ========= -1.0.4 (2016-08-04) +0.1.5 (2016-09-09) ------------------ -* New events UserAle is tracking: +* clientTime field is represented in ISO 8601 format. +* Sampling ``mouseenter``, ``mouseleave``, and ``dragmove`` events by ``resolution`` parameter. +* Added Apache license headers. +* Updated versioning numbers. +* Added docker support. - * ``mousemove`` +0.1.4 (2016-08-04) +------------------ +* New events Apache UserAle is tracking: + + * ``move`` * ``resize`` * ``scroll`` * Remove timer from ``dragdrop`` log due to incorrect time being recorded. * Session id is autogenerated if not passed into configuration. -1.0.3 (2016-08-02) +0.1.3 (2016-08-02) ------------------ -* New events UserAle is tracking: +* New events Apache UserAle is tracking: * ``mouseenter`` * ``mouseleave`` -1.0.2 (2016-08-01) +0.1.2 (2016-08-01) ------------------ * The elapsed time for a drag event is being recorded in the ``dragdrop`` log. -1.0.1 (2016-07-29) +0.1.1 (2016-07-29) ------------------ * All logs will be stored to file called userale.log (configurable). -* Users can specify which events to capture by passing in a list of event keys when instantiating UserAle. -* These are the events UserAle is tracking: +* Users can specify which events to capture by passing in a list of event keys when instantiating Apache UserAle. +* These are the events Apache UserAle is tracking: * ``mouseup`` * ``mousedown`` - * ``mouseover`` + * ``mousemove`` * ``keypress`` (optional) * ``keydown`` (optional) * ``dragenter`` @@ -42,7 +65,7 @@ Changelog * ``dragmove`` * ``dragdrop`` -1.0.0 (2016-06-24) +0.1.0 (2016-06-24) ------------------ Initial release. \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-senssoft-userale-pyqt5/blob/95e2e056/CONTRIBUTING.rst ---------------------------------------------------------------------- diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst index 705f977..00ad167 100644 --- a/CONTRIBUTING.rst +++ b/CONTRIBUTING.rst @@ -1,3 +1,18 @@ +<!--Licensed to the Apache Software Foundation (ASF) under one or more +contributor license agreements. See the NOTICE file distributed with +this work for additional information regarding copyright ownership. +The ASF licenses this file to You under the Apache License, Version 2.0 +(the "License"); you may not use this file except in compliance with +the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. --> + .. _contributing: Contributing to UserAle.pyqt5 http://git-wip-us.apache.org/repos/asf/incubator-senssoft-userale-pyqt5/blob/95e2e056/Dockerfile ---------------------------------------------------------------------- diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..96fa80a --- /dev/null +++ b/Dockerfile @@ -0,0 +1,33 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Ubuntu Xenial 16.04 [LTS] +FROM ubuntu:16.04 + +# Install Deps +RUN apt-get update -yqq && \ + apt-get install -yqq python3-dev python3-pip qt5-default && \ + apt-get clean && \ + rm -rf /var/lib/apt/lists/* + +COPY requirements.txt /opt/userale + +WORKDIR /opt + +# Install requirements +RUN pip3 install -r requirements.txt + +#CMD ["python", "./setup.py", "develop"] + http://git-wip-us.apache.org/repos/asf/incubator-senssoft-userale-pyqt5/blob/95e2e056/LICENSE ---------------------------------------------------------------------- diff --git a/LICENSE b/LICENSE index 8b33aad..af2bbe3 100644 --- a/LICENSE +++ b/LICENSE @@ -199,3 +199,61 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. + +================================================================================ + +Apache UserALE.PyQt5 Subcomponents: + +The Apache UserALE.pyqt5 project contains subcomponents with separate copyright +notices and license terms. Your use of the source code for the these +subcomponents is subject to the terms and conditions of the following +licenses. + +For + userale/examples/testclose.py + userale/examples/testdragndrop.py + userale/examples/testdragndrop2.py + + ZetCode PyQt5 tutorial + + Copyright (C) 2007 - 2016 Jan Bodnar + All rights reserved. + +For + userale/examples/testwindowflags.py: + + Copyright (C) 2013 Riverbank Computing Limited. + Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). + All rights reserved. + + This file is part of the examples of PyQt. + + You may use this file under the terms of the BSD license as follows: + + "Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are + met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor + the names of its contributors may be used to endorse or promote + products derived from this software without specific prior written + permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." + +================================================================================ \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-senssoft-userale-pyqt5/blob/95e2e056/NOTICE ---------------------------------------------------------------------- diff --git a/NOTICE b/NOTICE new file mode 100644 index 0000000..60d0cac --- /dev/null +++ b/NOTICE @@ -0,0 +1,5 @@ +Apache UserALE.pyqt5 +Copyright 2016 The Apache Software Foundation + +This product includes software developed at +The Apache Software Foundation (http://www.apache.org/). \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-senssoft-userale-pyqt5/blob/95e2e056/README.rst ---------------------------------------------------------------------- diff --git a/README.rst b/README.rst index cd27bd0..f4b2ed5 100644 --- a/README.rst +++ b/README.rst @@ -1,3 +1,18 @@ +<!--Licensed to the Apache Software Foundation (ASF) under one or more +contributor license agreements. See the NOTICE file distributed with +this work for additional information regarding copyright ownership. +The ASF licenses this file to You under the Apache License, Version 2.0 +(the "License"); you may not use this file except in compliance with +the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. --> + UserAle ======= http://git-wip-us.apache.org/repos/asf/incubator-senssoft-userale-pyqt5/blob/95e2e056/docs/Makefile ---------------------------------------------------------------------- diff --git a/docs/Makefile b/docs/Makefile index eff75bf..abf99bb 100644 --- a/docs/Makefile +++ b/docs/Makefile @@ -1,3 +1,18 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + # Makefile for Sphinx documentation # http://git-wip-us.apache.org/repos/asf/incubator-senssoft-userale-pyqt5/blob/95e2e056/docs/make.bat ---------------------------------------------------------------------- diff --git a/docs/make.bat b/docs/make.bat index 36ad11e..9ac9469 100644 --- a/docs/make.bat +++ b/docs/make.bat @@ -1,3 +1,18 @@ +:: Licensed to the Apache Software Foundation (ASF) under one or more +:: contributor license agreements. See the NOTICE file distributed with +:: this work for additional information regarding copyright ownership. +:: The ASF licenses this file to You under the Apache License, Version 2.0 +:: (the "License"); you may not use this file except in compliance with +:: the License. You may obtain a copy of the License at +:: +:: http://www.apache.org/licenses/LICENSE-2.0 +:: +:: Unless required by applicable law or agreed to in writing, software +:: distributed under the License is distributed on an "AS IS" BASIS, +:: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +:: See the License for the specific language governing permissions and +:: limitations under the License. + @ECHO OFF REM Command file for Sphinx documentation http://git-wip-us.apache.org/repos/asf/incubator-senssoft-userale-pyqt5/blob/95e2e056/docs/source/authors.rst ---------------------------------------------------------------------- diff --git a/docs/source/authors.rst b/docs/source/authors.rst index 2c70d61..a919b4e 100644 --- a/docs/source/authors.rst +++ b/docs/source/authors.rst @@ -1,3 +1,18 @@ +<!--Licensed to the Apache Software Foundation (ASF) under one or more +contributor license agreements. See the NOTICE file distributed with +this work for additional information regarding copyright ownership. +The ASF licenses this file to You under the Apache License, Version 2.0 +(the "License"); you may not use this file except in compliance with +the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. --> + Authors ------- http://git-wip-us.apache.org/repos/asf/incubator-senssoft-userale-pyqt5/blob/95e2e056/docs/source/changelog.rst ---------------------------------------------------------------------- diff --git a/docs/source/changelog.rst b/docs/source/changelog.rst index 09929fe..77e020b 100644 --- a/docs/source/changelog.rst +++ b/docs/source/changelog.rst @@ -1 +1,16 @@ +<!--Licensed to the Apache Software Foundation (ASF) under one or more +contributor license agreements. See the NOTICE file distributed with +this work for additional information regarding copyright ownership. +The ASF licenses this file to You under the Apache License, Version 2.0 +(the "License"); you may not use this file except in compliance with +the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. --> + .. include:: ../../CHANGELOG.rst http://git-wip-us.apache.org/repos/asf/incubator-senssoft-userale-pyqt5/blob/95e2e056/docs/source/conf.py ---------------------------------------------------------------------- diff --git a/docs/source/conf.py b/docs/source/conf.py index 5b2b3bf..b9e85d2 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -1,3 +1,18 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + # UserAle documentation build configuration file, created by # sphinx-quickstart on Fri Jun 24 16:58:43 2016. # http://git-wip-us.apache.org/repos/asf/incubator-senssoft-userale-pyqt5/blob/95e2e056/docs/source/contents.rst.inc ---------------------------------------------------------------------- diff --git a/docs/source/contents.rst.inc b/docs/source/contents.rst.inc index cae63f1..57355ab 100644 --- a/docs/source/contents.rst.inc +++ b/docs/source/contents.rst.inc @@ -1,3 +1,18 @@ +<!--Licensed to the Apache Software Foundation (ASF) under one or more +contributor license agreements. See the NOTICE file distributed with +this work for additional information regarding copyright ownership. +The ASF licenses this file to You under the Apache License, Version 2.0 +(the "License"); you may not use this file except in compliance with +the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. --> + User's Guide ------------ http://git-wip-us.apache.org/repos/asf/incubator-senssoft-userale-pyqt5/blob/95e2e056/docs/source/contributing.rst ---------------------------------------------------------------------- diff --git a/docs/source/contributing.rst b/docs/source/contributing.rst index 8cb3146..43e2269 100644 --- a/docs/source/contributing.rst +++ b/docs/source/contributing.rst @@ -1 +1,16 @@ +<!--Licensed to the Apache Software Foundation (ASF) under one or more +contributor license agreements. See the NOTICE file distributed with +this work for additional information regarding copyright ownership. +The ASF licenses this file to You under the Apache License, Version 2.0 +(the "License"); you may not use this file except in compliance with +the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. --> + .. include:: ../../CONTRIBUTING.rst \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-senssoft-userale-pyqt5/blob/95e2e056/docs/source/index.rst ---------------------------------------------------------------------- diff --git a/docs/source/index.rst b/docs/source/index.rst index e6cf542..8ab9893 100644 --- a/docs/source/index.rst +++ b/docs/source/index.rst @@ -1,3 +1,18 @@ +<!--Licensed to the Apache Software Foundation (ASF) under one or more +contributor license agreements. See the NOTICE file distributed with +this work for additional information regarding copyright ownership. +The ASF licenses this file to You under the Apache License, Version 2.0 +(the "License"); you may not use this file except in compliance with +the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. --> + .. include:: ../../README.rst .. include:: contents.rst.inc http://git-wip-us.apache.org/repos/asf/incubator-senssoft-userale-pyqt5/blob/95e2e056/docs/source/installation.rst ---------------------------------------------------------------------- diff --git a/docs/source/installation.rst b/docs/source/installation.rst index 4717cd0..ce02451 100644 --- a/docs/source/installation.rst +++ b/docs/source/installation.rst @@ -1,3 +1,18 @@ +<!--Licensed to the Apache Software Foundation (ASF) under one or more +contributor license agreements. See the NOTICE file distributed with +this work for additional information regarding copyright ownership. +The ASF licenses this file to You under the Apache License, Version 2.0 +(the "License"); you may not use this file except in compliance with +the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. --> + .. _installation: Installation Guide http://git-wip-us.apache.org/repos/asf/incubator-senssoft-userale-pyqt5/blob/95e2e056/docs/source/license.rst ---------------------------------------------------------------------- diff --git a/docs/source/license.rst b/docs/source/license.rst index d31cf73..d197d89 100644 --- a/docs/source/license.rst +++ b/docs/source/license.rst @@ -1,13 +1,29 @@ +<!--Licensed to the Apache Software Foundation (ASF) under one or more +contributor license agreements. See the NOTICE file distributed with +this work for additional information regarding copyright ownership. +The ASF licenses this file to You under the Apache License, Version 2.0 +(the "License"); you may not use this file except in compliance with +the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. --> + License ======= -Copyright 2016 The Charles Stark Draper Laboratory, Inc. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at +Licensed to the Apache Software Foundation (ASF) under one or more +contributor license agreements. See the NOTICE file distributed with +this work for additional information regarding copyright ownership. +The ASF licenses this file to You under the Apache License, Version 2.0 +(the "License"); you may not use this file except in compliance with +the License. You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 + http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, http://git-wip-us.apache.org/repos/asf/incubator-senssoft-userale-pyqt5/blob/95e2e056/docs/source/quickstart.rst ---------------------------------------------------------------------- diff --git a/docs/source/quickstart.rst b/docs/source/quickstart.rst index 1a8f8a2..31e9921 100644 --- a/docs/source/quickstart.rst +++ b/docs/source/quickstart.rst @@ -1,3 +1,18 @@ +<!--Licensed to the Apache Software Foundation (ASF) under one or more +contributor license agreements. See the NOTICE file distributed with +this work for additional information regarding copyright ownership. +The ASF licenses this file to You under the Apache License, Version 2.0 +(the "License"); you may not use this file except in compliance with +the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. --> + .. _quickstart: Quickstart Guide http://git-wip-us.apache.org/repos/asf/incubator-senssoft-userale-pyqt5/blob/95e2e056/docs/source/userale.rst ---------------------------------------------------------------------- diff --git a/docs/source/userale.rst b/docs/source/userale.rst index ade0cab..ec83da4 100644 --- a/docs/source/userale.rst +++ b/docs/source/userale.rst @@ -1,3 +1,18 @@ +<!--Licensed to the Apache Software Foundation (ASF) under one or more +contributor license agreements. See the NOTICE file distributed with +this work for additional information regarding copyright ownership. +The ASF licenses this file to You under the Apache License, Version 2.0 +(the "License"); you may not use this file except in compliance with +the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. --> + .. _api: http://git-wip-us.apache.org/repos/asf/incubator-senssoft-userale-pyqt5/blob/95e2e056/requirements.txt ---------------------------------------------------------------------- diff --git a/requirements.txt b/requirements.txt index c219351..969c527 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,12 +1,11 @@ -# -*- coding: utf-8 -*- +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at # -# Copyright 2016 The Charles Stark Draper Laboratory, Inc. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 +# http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, http://git-wip-us.apache.org/repos/asf/incubator-senssoft-userale-pyqt5/blob/95e2e056/setup.cfg ---------------------------------------------------------------------- diff --git a/setup.cfg b/setup.cfg index e639aa1..10bbb43 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,3 +1,18 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + [egg_info] tag_svn_revision = false http://git-wip-us.apache.org/repos/asf/incubator-senssoft-userale-pyqt5/blob/95e2e056/setup.py ---------------------------------------------------------------------- diff --git a/setup.py b/setup.py index bfdf020..ae7e75a 100644 --- a/setup.py +++ b/setup.py @@ -1,10 +1,11 @@ -# Copyright 2016 The Charles Stark Draper Laboratory, Inc. +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 +# http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, @@ -79,7 +80,8 @@ setup ( 'mouse = userale.examples.testapp:test_app', 'drag = userale.examples.testdragndrop:test_drag', 'drag2 = userale.examples.testdragndrop2:test_drag2', - 'window = userale.examples.testclose:test_close' + 'window = userale.examples.testclose:test_close', + 'controller = userale.examples.testwindowflags:test_controller' ] } ) http://git-wip-us.apache.org/repos/asf/incubator-senssoft-userale-pyqt5/blob/95e2e056/userale/__init__.py ---------------------------------------------------------------------- diff --git a/userale/__init__.py b/userale/__init__.py index 1c6a16b..bbcbee0 100644 --- a/userale/__init__.py +++ b/userale/__init__.py @@ -1,12 +1,11 @@ -# -*- coding: utf-8 -*- +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at # -# Copyright 2016 The Charles Stark Draper Laboratory, Inc. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 +# http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, http://git-wip-us.apache.org/repos/asf/incubator-senssoft-userale-pyqt5/blob/95e2e056/userale/ale.py ---------------------------------------------------------------------- diff --git a/userale/ale.py b/userale/ale.py index ec7f9fb..fde937e 100644 --- a/userale/ale.py +++ b/userale/ale.py @@ -1,10 +1,11 @@ -# Copyright 2016 The Charles Stark Draper Laboratory, Inc. +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 +# http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, @@ -13,36 +14,33 @@ # limitations under the License. from userale.version import __version__ -from userale.format import StructuredMessage - +from userale.format import JsonFormatter from PyQt5.QtCore import QObject, QEvent import datetime import logging import uuid -_ = StructuredMessage +_ = JsonFormatter class Ale (QObject): def __init__(self, output="userale.log", - interval=5000, user=None, session=None, toolname=None, toolversion=None, keylog=False, - resolution=500, + resolution=100, shutoff=[]): """ :param output: [str] The file or url path to which logs will be sent - :param interval: [int] The minimum time interval in ms betweeen batch transmission of logs :param user: [str] Identifier for the user of the application :param session: [str] Session tag to track same user with multiple sessions. If a session is not provided, one will be created :param toolname: [str] The application name :param toolversion: [str] The application version :param keylog: [bool] Should detailed key logs be recorded. Default is False - :param resolution: [int] Delay in ms between instances of high frequency logs like movemoves, scrolls, etc + :param resolution: [int] Delay in ms between instances of high frequency logs like mousemoves, scrolls, etc. Default is 100ms (10Hz). :param shutoff: [list] Turn off logging for specific events An example log will appear like this: @@ -61,15 +59,13 @@ class Ale (QObject): 'session': '5ee42ccc-852c-44d9-a937-28d7901e4ead', 'toolName': 'myApplication', 'toolVersion': '3.5.0', - 'useraleVersion': '1.0.0' + 'useraleVersion': '0.1.0' } """ QObject.__init__(self) - # UserAle Configuration self.output = output - self.interval = interval self.user = user # Autogenerate session id if session is not configured self.session = session if session is not None else str (uuid.uuid4 ()) @@ -79,9 +75,6 @@ class Ale (QObject): self.resolution = resolution self.shutoff = shutoff - # Store logs - self.logs = [] - # Configure logging self.logger = logging self.logger.basicConfig(level=logging.INFO, @@ -112,49 +105,76 @@ class Ale (QObject): if name in self.shutoff or (not self.keylog and (name == 'keypress' or name == 'keyrelease')): del self.map [key] + # Sample rate + self.hfreq = [QEvent.MouseMove, QEvent.DragMove, QEvent.Scroll] + self.logs = [] + self.last = None + self.timer = None + self.flag = False + def eventFilter (self, object, event): ''' :param object: [QObject] The object being watched. :param event: [QEvent] The event triggered by a user action. - :return: [bool] Return true in order to filter the event out (stop it from being handled further). Otherwise return false. + :return: [bool] Propagate filter up if other objects needs to be handled - Filters events for the watched object (in this case, QApplication) + Filters events for the watched widget (in this case, QApplication) ''' + if self.flag == False: + self.flag = True + self.timer = datetime.datetime.now () + data = None t = event.type () - # if self.__valid (object) and t in self.map: - # if len (object.children ()) > 0 and t in self.map: - if t in self.map: - name = list (self.map [t].keys())[0] - method = list (self.map [t].values())[0] - data = method (name, event, object) + if t in self.map: + # Handle leaf node + if object.isWidgetType () and len(object.children ()) == 0: + name = list (self.map [t].keys())[0] + method = list (self.map [t].values())[0] + data = method (name, event, object) + + # Handle window object + else: + # How to handle events on windows? It comes before the child widgets in window? + # Either an event actually ocurred on window or is an effect of event propagation. + pass + + # Sample data + self.logs.append (data) + + # Check time elapsed + elapsed = datetime.datetime.now () - self.timer + if elapsed.seconds == 1: + # print ("count = %d", len (self.logs)) + self.flag = False + self.logs = [] if data is not None: self.logger.info (_(data)) + return super(Ale, self).eventFilter (object, event) - def __valid (self, object): - # Parent is none? - # capture it - # Parent exists - don't capture/capture Child/current object - - # Solo node - if object.parent () is None and len (object.children ()) == 0: - return True + def getSender (self, object): + ''' + :param object: [QObject] The object being watched. + :return: [QObject] The QObject + ''' - # Leaf node - if object.parent () is not None and len (object.children ()) == 0: - return True - return False + sender = None + try: + sender = object.sender () if object.sender() is not None else None + except: + pass + return sender def getSelector (self, object): """ :param object: [QObject] The base class for all Qt objects. :return: [str] The Qt object's name - Get target object's name (object defined by user or object's meta class name) + Get target object's name (object defined by user or object's meta class name). """ return object.objectName () if object.objectName () else object.staticMetaObject.className () @@ -175,10 +195,9 @@ class Ale (QObject): def getPath (self, object): """ :param object: [QObject] The base class for all Qt objects. - :return: [list] List of QObjects up to the child object. + :return: [list] List of QObjects. - Fetch the entire path up the root of the tree for a leaf node object. - Recursive operation. + Generate the entire object hierachy from root to leaf node. """ if object.parent() is not None: @@ -188,12 +207,12 @@ class Ale (QObject): def getClientTime (self): """ - :return: [str] String representation of the time the event was triggered. + :return: [str] String representation of the time the event was captured. - Capture the time the event was captured. + Capture the time the event was captured in milliseconds since the UNIX epoch (January 1, 1970 00:00:00 UTC) """ - return str (datetime.datetime.now ()) + return int (time.time() * 1000) def handleMouseEvents (self, event_type, event, object): """ @@ -204,8 +223,9 @@ class Ale (QObject): Returns the userale log representing all mouse event data. """ - - return self.__create_msg (event_type, event, object) + + details = {} + return self.__create_msg (event_type, event, object, details=details) def handleKeyEvents (self, event_type, event, object): """ @@ -217,7 +237,7 @@ class Ale (QObject): Returns the userale log representing all key events, including key name and key code. """ - details = {'key' : event.text (), 'keycode' : event.key ()} + details = {"key" : event.text (), "keycode" : event.key ()} return self.__create_msg (event_type, event, object, details=details) def handleDragEvents (self, event_type, event, object): @@ -233,7 +253,7 @@ class Ale (QObject): details = {} try: - details ["source"] = self.getSelector (event.source()) + details ["source"] = self.getSelector (event.source ()) except: details ["source"] = None @@ -248,6 +268,7 @@ class Ale (QObject): Returns the userale log representing all move events. """ + details = {"oldPos" : {"x" : event.oldPos ().x (), "y" : event.oldPos ().y ()}} return self.__create_msg (event_type, event, object, details=details) @@ -260,6 +281,7 @@ class Ale (QObject): Returns the userale log representing all resize events. """ + details = {"size" : {"height" : event.size ().height (), "width" : event.size ().width ()}, "oldSize": {"height" : event.oldSize ().height (), "width" : event.oldSize ().width ()}} return self.__create_msg (event_type, event, object, details=details) @@ -273,6 +295,7 @@ class Ale (QObject): Returns the userale log representing all scroll events. """ + return self.__create_msg (event_type, event, object) def __create_msg (self, event_type, event, object, details={}): @@ -281,18 +304,18 @@ class Ale (QObject): """ data = { - 'target': self.getSelector (object) , - 'path': self.getPath (object), - 'clientTime': self.getClientTime (), - 'location': self.getLocation (event), - 'type': event_type , - 'userAction': 'true', - 'details' : details, - 'userId': self.user, - 'session': self.session, - 'toolName': self.toolname, - 'toolVersion': self.toolversion, - 'useraleVersion': __version__ + "target": self.getSelector (object) , + "path": self.getPath (object), + "clientTime": self.getClientTime (), + "location": self.getLocation (event), + "type": event_type , + "userAction": True, # legacy field + "details" : details, + "userId": self.user, + "session": self.session, + "toolName": self.toolname, + "toolVersion": self.toolversion, + "useraleVersion": __version__ } return data http://git-wip-us.apache.org/repos/asf/incubator-senssoft-userale-pyqt5/blob/95e2e056/userale/examples/__init__.py ---------------------------------------------------------------------- diff --git a/userale/examples/__init__.py b/userale/examples/__init__.py index e69de29..fa8ccd5 100644 --- a/userale/examples/__init__.py +++ b/userale/examples/__init__.py @@ -0,0 +1,14 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-senssoft-userale-pyqt5/blob/95e2e056/userale/examples/testapp.py ---------------------------------------------------------------------- diff --git a/userale/examples/testapp.py b/userale/examples/testapp.py index 443cf83..e30d4f3 100644 --- a/userale/examples/testapp.py +++ b/userale/examples/testapp.py @@ -1,12 +1,11 @@ -# -*- coding: utf-8 -*- +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at # -# Copyright 2016 The Charles Stark Draper Laboratory, Inc. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 +# http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, @@ -44,7 +43,7 @@ def test_app (): app = QApplication(sys.argv) app.setObjectName ("testApplication") ex = TestApplication() - ale = Ale (output="mouse.log", user="testUser", version="0.0.1") + ale = Ale (output="mouse.log", user="testUser", toolname="mousetest", toolversion="0.0.1") # install globally app.installEventFilter (ale) http://git-wip-us.apache.org/repos/asf/incubator-senssoft-userale-pyqt5/blob/95e2e056/userale/examples/testclose.py ---------------------------------------------------------------------- diff --git a/userale/examples/testclose.py b/userale/examples/testclose.py index 9edf142..0daef24 100644 --- a/userale/examples/testclose.py +++ b/userale/examples/testclose.py @@ -1,3 +1,18 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + """ ZetCode PyQt5 tutorial http://git-wip-us.apache.org/repos/asf/incubator-senssoft-userale-pyqt5/blob/95e2e056/userale/examples/testdragndrop.py ---------------------------------------------------------------------- diff --git a/userale/examples/testdragndrop.py b/userale/examples/testdragndrop.py index 005f410..67db2e5 100644 --- a/userale/examples/testdragndrop.py +++ b/userale/examples/testdragndrop.py @@ -1,4 +1,17 @@ -# -*- coding: utf-8 -*- +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. """ ZetCode PyQt5 tutorial @@ -58,12 +71,13 @@ class ExampleWidget(QWidget): self.setWindowTitle('Simple drag & drop') self.setGeometry(300, 300, 300, 150) - + self.setObjectName ("examplewidget1") def test_drag (): app = QApplication(sys.argv) + app.setObjectName ("dragApplication") # Turn off mouse click's and keylogging - ale = Ale (shutoff=['mousemove', 'dragmove'], keylog=True) + ale = Ale (shutoff=['mousemove', 'mousedown', 'dragmove'], keylog=True) # install globally app.installEventFilter (ale) ex = ExampleWidget() http://git-wip-us.apache.org/repos/asf/incubator-senssoft-userale-pyqt5/blob/95e2e056/userale/examples/testdragndrop2.py ---------------------------------------------------------------------- diff --git a/userale/examples/testdragndrop2.py b/userale/examples/testdragndrop2.py index c5f74a9..0a8fd58 100644 --- a/userale/examples/testdragndrop2.py +++ b/userale/examples/testdragndrop2.py @@ -1,4 +1,17 @@ -# -*- coding: utf-8 -*- +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. """ ZetCode PyQt5 tutorial @@ -82,7 +95,7 @@ class Example(QWidget): def test_drag2 (): app = QApplication(sys.argv) ex = Example() - ale = Ale () + ale = Ale (output="drag2.log", user="testUser", toolname="dragtest", toolversion="0.0.1") # install globally app.installEventFilter (ale) ex.show() http://git-wip-us.apache.org/repos/asf/incubator-senssoft-userale-pyqt5/blob/95e2e056/userale/examples/testwindowflags.py ---------------------------------------------------------------------- diff --git a/userale/examples/testwindowflags.py b/userale/examples/testwindowflags.py new file mode 100644 index 0000000..a02af7e --- /dev/null +++ b/userale/examples/testwindowflags.py @@ -0,0 +1,261 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from PyQt5.QtCore import Qt +from PyQt5.QtWidgets import (QApplication, QCheckBox, QGridLayout, QGroupBox, + QHBoxLayout, QPushButton, QRadioButton, QTextEdit, QVBoxLayout, + QWidget) + +from userale.ale import Ale + + +class PreviewWindow(QWidget): + def __init__(self, parent=None): + super(PreviewWindow, self).__init__(parent) + + self.textEdit = QTextEdit() + self.textEdit.setReadOnly(True) + self.textEdit.setLineWrapMode(QTextEdit.NoWrap) + + closeButton = QPushButton("&Close") + closeButton.clicked.connect(self.close) + + layout = QVBoxLayout() + layout.addWidget(self.textEdit) + layout.addWidget(closeButton) + self.setLayout(layout) + + self.setWindowTitle("Preview") + + def setWindowFlags(self, flags): + super(PreviewWindow, self).setWindowFlags(flags) + + flag_type = (flags & Qt.WindowType_Mask) + + if flag_type == Qt.Window: + text = "Qt.Window" + elif flag_type == Qt.Dialog: + text = "Qt.Dialog" + elif flag_type == Qt.Sheet: + text = "Qt.Sheet" + elif flag_type == Qt.Drawer: + text = "Qt.Drawer" + elif flag_type == Qt.Popup: + text = "Qt.Popup" + elif flag_type == Qt.Tool: + text = "Qt.Tool" + elif flag_type == Qt.ToolTip: + text = "Qt.ToolTip" + elif flag_type == Qt.SplashScreen: + text = "Qt.SplashScreen" + else: + text = "" + + if flags & Qt.MSWindowsFixedSizeDialogHint: + text += "\n| Qt.MSWindowsFixedSizeDialogHint" + if flags & Qt.X11BypassWindowManagerHint: + text += "\n| Qt.X11BypassWindowManagerHint" + if flags & Qt.FramelessWindowHint: + text += "\n| Qt.FramelessWindowHint" + if flags & Qt.WindowTitleHint: + text += "\n| Qt.WindowTitleHint" + if flags & Qt.WindowSystemMenuHint: + text += "\n| Qt.WindowSystemMenuHint" + if flags & Qt.WindowMinimizeButtonHint: + text += "\n| Qt.WindowMinimizeButtonHint" + if flags & Qt.WindowMaximizeButtonHint: + text += "\n| Qt.WindowMaximizeButtonHint" + if flags & Qt.WindowCloseButtonHint: + text += "\n| Qt.WindowCloseButtonHint" + if flags & Qt.WindowContextHelpButtonHint: + text += "\n| Qt.WindowContextHelpButtonHint" + if flags & Qt.WindowShadeButtonHint: + text += "\n| Qt.WindowShadeButtonHint" + if flags & Qt.WindowStaysOnTopHint: + text += "\n| Qt.WindowStaysOnTopHint" + if flags & Qt.WindowStaysOnBottomHint: + text += "\n| Qt.WindowStaysOnBottomHint" + if flags & Qt.CustomizeWindowHint: + text += "\n| Qt.CustomizeWindowHint" + + self.textEdit.setPlainText(text) + + +class ControllerWindow(QWidget): + def __init__(self): + super(ControllerWindow, self).__init__() + + self.previewWindow = PreviewWindow(self) + + self.createTypeGroupBox() + self.createHintsGroupBox() + + quitButton = QPushButton("&Quit") + quitButton.clicked.connect(self.close) + + bottomLayout = QHBoxLayout() + bottomLayout.addStretch() + bottomLayout.addWidget(quitButton) + + mainLayout = QVBoxLayout() + mainLayout.addWidget(self.typeGroupBox) + mainLayout.addWidget(self.hintsGroupBox) + mainLayout.addLayout(bottomLayout) + self.setLayout(mainLayout) + + self.setWindowTitle("Window Flags") + self.updatePreview() + + def updatePreview(self): + flags = Qt.WindowFlags() + + if self.windowRadioButton.isChecked(): + flags = Qt.Window + elif self.dialogRadioButton.isChecked(): + flags = Qt.Dialog + elif self.sheetRadioButton.isChecked(): + flags = Qt.Sheet + elif self.drawerRadioButton.isChecked(): + flags = Qt.Drawer + elif self.popupRadioButton.isChecked(): + flags = Qt.Popup + elif self.toolRadioButton.isChecked(): + flags = Qt.Tool + elif self.toolTipRadioButton.isChecked(): + flags = Qt.ToolTip + elif self.splashScreenRadioButton.isChecked(): + flags = Qt.SplashScreen + + if self.msWindowsFixedSizeDialogCheckBox.isChecked(): + flags |= Qt.MSWindowsFixedSizeDialogHint + if self.x11BypassWindowManagerCheckBox.isChecked(): + flags |= Qt.X11BypassWindowManagerHint + if self.framelessWindowCheckBox.isChecked(): + flags |= Qt.FramelessWindowHint + if self.windowTitleCheckBox.isChecked(): + flags |= Qt.WindowTitleHint + if self.windowSystemMenuCheckBox.isChecked(): + flags |= Qt.WindowSystemMenuHint + if self.windowMinimizeButtonCheckBox.isChecked(): + flags |= Qt.WindowMinimizeButtonHint + if self.windowMaximizeButtonCheckBox.isChecked(): + flags |= Qt.WindowMaximizeButtonHint + if self.windowCloseButtonCheckBox.isChecked(): + flags |= Qt.WindowCloseButtonHint + if self.windowContextHelpButtonCheckBox.isChecked(): + flags |= Qt.WindowContextHelpButtonHint + if self.windowShadeButtonCheckBox.isChecked(): + flags |= Qt.WindowShadeButtonHint + if self.windowStaysOnTopCheckBox.isChecked(): + flags |= Qt.WindowStaysOnTopHint + if self.windowStaysOnBottomCheckBox.isChecked(): + flags |= Qt.WindowStaysOnBottomHint + if self.customizeWindowHintCheckBox.isChecked(): + flags |= Qt.CustomizeWindowHint + + self.previewWindow.setWindowFlags(flags) + + pos = self.previewWindow.pos() + + if pos.x() < 0: + pos.setX(0) + + if pos.y() < 0: + pos.setY(0) + + self.previewWindow.move(pos) + self.previewWindow.show() + + def createTypeGroupBox(self): + self.typeGroupBox = QGroupBox("Type") + + self.windowRadioButton = self.createRadioButton("Window") + self.dialogRadioButton = self.createRadioButton("Dialog") + self.sheetRadioButton = self.createRadioButton("Sheet") + self.drawerRadioButton = self.createRadioButton("Drawer") + self.popupRadioButton = self.createRadioButton("Popup") + self.toolRadioButton = self.createRadioButton("Tool") + self.toolTipRadioButton = self.createRadioButton("Tooltip") + self.splashScreenRadioButton = self.createRadioButton("Splash screen") + self.windowRadioButton.setChecked(True) + + layout = QGridLayout() + layout.addWidget(self.windowRadioButton, 0, 0) + layout.addWidget(self.dialogRadioButton, 1, 0) + layout.addWidget(self.sheetRadioButton, 2, 0) + layout.addWidget(self.drawerRadioButton, 3, 0) + layout.addWidget(self.popupRadioButton, 0, 1) + layout.addWidget(self.toolRadioButton, 1, 1) + layout.addWidget(self.toolTipRadioButton, 2, 1) + layout.addWidget(self.splashScreenRadioButton, 3, 1) + self.typeGroupBox.setLayout(layout) + + def createHintsGroupBox(self): + self.hintsGroupBox = QGroupBox("Hints") + + self.msWindowsFixedSizeDialogCheckBox = self.createCheckBox("MS Windows fixed size dialog") + self.x11BypassWindowManagerCheckBox = self.createCheckBox("X11 bypass window manager") + self.framelessWindowCheckBox = self.createCheckBox("Frameless window") + self.windowTitleCheckBox = self.createCheckBox("Window title") + self.windowSystemMenuCheckBox = self.createCheckBox("Window system menu") + self.windowMinimizeButtonCheckBox = self.createCheckBox("Window minimize button") + self.windowMaximizeButtonCheckBox = self.createCheckBox("Window maximize button") + self.windowCloseButtonCheckBox = self.createCheckBox("Window close button") + self.windowContextHelpButtonCheckBox = self.createCheckBox("Window context help button") + self.windowShadeButtonCheckBox = self.createCheckBox("Window shade button") + self.windowStaysOnTopCheckBox = self.createCheckBox("Window stays on top") + self.windowStaysOnBottomCheckBox = self.createCheckBox("Window stays on bottom") + self.customizeWindowHintCheckBox = self.createCheckBox("Customize window") + + layout = QGridLayout() + layout.addWidget(self.msWindowsFixedSizeDialogCheckBox, 0, 0) + layout.addWidget(self.x11BypassWindowManagerCheckBox, 1, 0) + layout.addWidget(self.framelessWindowCheckBox, 2, 0) + layout.addWidget(self.windowTitleCheckBox, 3, 0) + layout.addWidget(self.windowSystemMenuCheckBox, 4, 0) + layout.addWidget(self.windowMinimizeButtonCheckBox, 0, 1) + layout.addWidget(self.windowMaximizeButtonCheckBox, 1, 1) + layout.addWidget(self.windowCloseButtonCheckBox, 2, 1) + layout.addWidget(self.windowContextHelpButtonCheckBox, 3, 1) + layout.addWidget(self.windowShadeButtonCheckBox, 4, 1) + layout.addWidget(self.windowStaysOnTopCheckBox, 5, 1) + layout.addWidget(self.windowStaysOnBottomCheckBox, 6, 1) + layout.addWidget(self.customizeWindowHintCheckBox, 5, 0) + self.hintsGroupBox.setLayout(layout) + + def createCheckBox(self, text): + checkBox = QCheckBox(text) + checkBox.clicked.connect(self.updatePreview) + return checkBox + + def createRadioButton(self, text): + button = QRadioButton(text) + button.clicked.connect(self.updatePreview) + return button + + +def test_controller (): + import sys + + app = QApplication(sys.argv) + controller = ControllerWindow() + + # Initiate UserAle + ale = Ale(output='window.log', user='testuser', toolname="Controller", toolversion="0.0.1", shutoff=["mousemove", "mouseleave", "mouseenter"]) + # install globally + app.installEventFilter(ale) + + controller.show() + sys.exit(app.exec_()) \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-senssoft-userale-pyqt5/blob/95e2e056/userale/format.py ---------------------------------------------------------------------- diff --git a/userale/format.py b/userale/format.py index aeeb6ba..7b1c750 100644 --- a/userale/format.py +++ b/userale/format.py @@ -1,10 +1,11 @@ -# Copyright 2016 The Charles Stark Draper Laboratory, Inc. +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 +# http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, @@ -21,11 +22,11 @@ import json # Logger will need to optinally handle authorization # through basic http auth, proxy, and SOCKS -class StructuredMessage (object): +class JsonFormatter (object): """ """ def __init__(self, data): self.data = data def __str__(self): - return '%s' % (json.dumps (self.data, sort_keys=False, indent=4)) + return "%s" % (json.dumps (self.data, sort_keys=False)) http://git-wip-us.apache.org/repos/asf/incubator-senssoft-userale-pyqt5/blob/95e2e056/userale/version.py ---------------------------------------------------------------------- diff --git a/userale/version.py b/userale/version.py index 8fb4bc6..48782d9 100644 --- a/userale/version.py +++ b/userale/version.py @@ -1,10 +1,11 @@ -# Copyright 2016 The Charles Stark Draper Laboratory, Inc. +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at # -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 +# http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, @@ -18,4 +19,4 @@ This file is imported by ``UserAle.__init__``, and parsed by ``setup.py``. """ -__version__ = "1.0.4" \ No newline at end of file +__version__ = "0.1.5" \ No newline at end of file