Skip to content
This repository has been archived by the owner on Jul 23, 2024. It is now read-only.

Commit

Permalink
Merged PR 54266: InQRy 1.0 (Merge develop into master)
Browse files Browse the repository at this point in the history
## InQRy 1.0

### New
- Runs as an executable on both Windows and Mac
- Creates appropriate set of data for [Snipe-IT](https://github.com/snipe/snipe-it) based on model (Mac only)
- GUI with field for entering user alias
- Documentation and code to configure barcode scanner

### Updates
- Several refactors now allow easier testing
- Addition of `QRAssetCode` and `Instructions` classes
- README contains correct installation and build instructions

### Fixed
- CPU speed field reads as `None` on Windows machines
- Internal storage not reported on MacBook Pro with Thunderbolt 3 ports
- Internal SSD not reported on Mac models with Fusion Drives
- Some users experiencing `zlib` dependency error during installation
- Some users experiencing installation error when both Python 2 and 3 are installed

### To Do
- PC model identification and/or database of known PC model s
- Generate QR code from an iOS device

Related work items: #1563607
  • Loading branch information
Eric Hanko committed Apr 25, 2017
2 parents bd4a6a4 + 4cc434c commit ae353c0
Show file tree
Hide file tree
Showing 73 changed files with 1,237 additions and 840 deletions.
154 changes: 137 additions & 17 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,21 +1,141 @@
.eggs/
.idea/workspace.xml
.idea/tasks.xml
.idea/libraries/
.idea/dictionaries/
.idea/*
.cache/
*.iml
*.egg-info
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

# Distribution / packaging
.Python
env/
build/
develop-eggs/
dist/
**/__pycache__/
*/__pycache__/
**.pyc
*.pyc
.python-version
qrtest.py
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
*.egg-info/
.installed.cfg
*.egg

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.coverage
!python.ini
coverage_html/
.coverage.*
.cache
nosetests.xml
coverage.xml
*,cover
.hypothesis/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
target/

# Jupyter Notebook
.ipynb_checkpoints

# pyenv
.python-version

# celery beat schedule file
celerybeat-schedule

# SageMath parsed files
*.sage.py

# dotenv
.env

# virtualenv
.venv
venv/
ENV/

# Spyder project settings
.spyderproject

# Rope project settings
.ropeproject

# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839

# User-specific stuff:
.idea/**/workspace.xml
.idea/**/tasks.xml

# Project settings:
.idea/**/misc.xml

# Sensitive or high-churn files:
.idea/**/dataSources/
.idea/**/dataSources.ids
.idea/**/dataSources.xml
.idea/**/dataSources.local.xml
.idea/**/sqlDataSources.xml
.idea/**/dynamic.xml
.idea/**/uiDesigner.xml

# Gradle:
.idea/**/gradle.xml
.idea/**/libraries

# Mongo Explorer plugin:
.idea/**/mongoSettings.xml

## File-based project format:
*.iws

## Plugin-specific files:

# IntelliJ
/out/

# mpeltonen/sbt-idea plugin
.idea_modules/

# JIRA plugin
atlassian-ide-plugin.xml

# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties
/.vs
12 changes: 12 additions & 0 deletions .idea/InQRy.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions .idea/inspectionProfiles/Project_Default.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 30 additions & 0 deletions InQRy.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import tkinter as tk
from inqry.asset_qrcode import AssetQRCode
from inqry.system_specs import systemspecs
from inqry.form_instructions import FormInstructions

ROOT = tk.Tk()


def calculate_center_coordinates(screen_dimension, current_dimension):
return (screen_dimension / 2) - (current_dimension / 2)


def obtain_default_dimensions_for_the_root_gui_object():
return tuple(int(_) for _ in ROOT.geometry().split('+')[0].split('x'))


def click():
data = FormInstructions(systemspecs.SystemSpecs(), alias_entry.get())
AssetQRCode(data).display()


if __name__ == '__main__':
ROOT.title("InQRy")
generate_qr_button = tk.Button(ROOT, text="Generate QR Code", command=click)
generate_qr_button.grid(row=1, column=1)
tk.Label(ROOT, text="Alias").grid(row=0)
alias_entry = tk.Entry(ROOT)
alias_entry.grid(row=0, column=1)
ROOT.focus_force()
ROOT.mainloop()
7 changes: 7 additions & 0 deletions QRreader-config/.rules.CC003279.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
rules_onDecode = function(a)
{
a.data = a.data.replace(/~t/g,"\x01X\x1ean//t\x04");
a.data = a.data.replace(/~d/g, "\x01X\x1ean//,\x04");
a.data = a.data.replace(/~e/g, "\x01X\x1ean//n\x04");
return a;
};
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added QRreader-config/B3 - Reboot Reader.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 21 additions & 0 deletions QRreader-config/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# QR Code Reader Configuration

## Requirements
- CR1400 series QR code reader by Code Corp.
- [CortexTools](http://www.codecorp.com/assets/download/D009015-CortexTools-2-5-26-Software.zip) (Windows only)
- rules.js file specific to InQRy (included in this repository)
- QR config codes specific to InQRy (included, also available from [Code Corp Support](http://www.codecorp.com/ConfigGuide/?product=CR1400-XHD))

## Configuration
1. Launch the CortexTools software and connect the reader via USB
2. Upon recognizing the reader, CortexTools will ask to switch it into "USB HID mode", choose yes as this is required to upload the rules file.
3. After the reader finishes switching, navigate to the file using "Open File". The rules.js is prefixed with a `.` (rendering it invisible), so you may find it easier to enter the path directly.
4. Once the rules.js file is displayed in the "Files to download to the reader" bar, click "Download File" and wait for the reader to complete the process.
5. Before closing CortexTools, click the keyboard icon to switch the reader back into "USB Keyboard mode" to prepare for the config codes in the next step.
6. Scan the config QR codes in the following order:
1. **A4 - Alternative Operating System (Linux/Mac) On**
2. **A2 - Suffix Tab (USB Keyboard Mode Only)**
3. **B3 - Reboot Reader**
4. **B2 - Save All Reader Settings - Default**
7. Test that the reader properly scans an InQRy QR code into the New Asset page of Snipe-IT. If it does not, start by scanning the Reboot Reader code and apply the four codes in the A4-A2-B3-B2 order.
8. Test that the reader maintains the configuration and properly scans InQRy codes after moving it to a new host machine.
81 changes: 62 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,43 +1,86 @@
# InQRy
Obtains machine hardware specifications then generates a QR code containing
the data.
## InQRy
Obtains machine hardware specifications and generates a QR code containing the data.

### Requirements
- `Python 3`
### Install (run from the command line)

##### Requirements
- Python 3.4.4 or later ([Homebrew](https://brew.sh/) installed version of Python 3 is recommended)

### Install
clone & `python3 setup.py install`
##### Instructions
- clone the repository
- `cd InQRy`
- `pip3 install .`
- Run: `python3 InQRy.py`
- Use the InQRy API from the Python interpreter with `import inqry`

### Test
`pytest`
###### Example API usage:
```
>>> from inqry.system_specs import systemspecs
>>> ss = systemspecs.SystemSpecs()
>>> ss.os_type
'Darwin'
>>> ss.memory
'8 GB'
>>> ss.storage
{'Drive 1': '251.0 GB SSD (APPLE SSD AP0256J)'}
```

### Build (run as compiled binary)
#### Mac
##### Requirements
- OS X 10.10 or later (OS X 10.10 is recommended for forward compatibility)
- Xcode Command Line Tools (7.2.0)
- py2app (0.12) (`pip3 install py2app`)

### Run
`python inqry` and click "Generate QR Code"
##### Instructions
- clone the repository
- `python3 setup.py py2app --iconfile inqry.icns`
- **InQRy.app** is in `dist/`

## Description
#### Windows
##### Requirements
- Windows 10
- Python 3.4 or 3.5 (32-bit)
- **Note**: InQRy will **not** build on Python 3.6 or later _or_ 64-bit Python)
- pyinstaller (3.2.1 or later)

##### Instructions
- clone the repository
- `pyinstaller --onefile --icon inqry.ico InQRy.py`
- **InQRy.exe** is in `dist/`

### Description
InQRy is a cross-platform application that generates a single QR code containing the machine's hardware
specifications. This application is designed primarily to be used during a physical inventory procedure.

The QR code contains detailed information about the client machine or device,
which can then be scanned it quickly add assets into a Snipe-IT database.
which can then be scanned it quickly add assets into a [Snipe-IT](https://github.com/snipe/snipe-it) database.

## How It Works
### How It Works

InQRy obtains hardware specs using shell commands and parses the output for
the desired information. It then takes that information, processes it and
instructs the `qrcode` Python module to create a QR code, which is displayed
instructs [python-qrcode](https://github.com/lincolnloop/python-qrcode) to create a QR code, which is displayed
on the screen for scanning.

InQRy determines which instructions to follow based on the
machine itself. Those instructions contain other necessary information that
allow it to move fluidly through different types of fields in the Snipe-IT asset
allow it to move fluidly through different types of fields in the [Snipe-IT](https://github.com/snipe/snipe-it) asset
entry form.

InQRy was written to obtain asset information quickly and accurately for both
an initial physical inventory procedure, as well as subsequent hardware audits.

## Currently Supported Platforms
- macOS
- Windows
### Currently Supported Platforms
- OS X 10.10 or later
- Windows 10

#### Issues? Suggestions? Questions?
- Submit a bug: [aka.ms/hubenglabsr](https://office.visualstudio.com/DefaultCollection/APEX/Lab-Support/_dashboards?activeDashboardId=88948f37-eb9b-4b40-a59a-b615aff02d4d)
- Email: [[email protected]](mailto:[email protected])
- Slack (apex-autoinfra.slack.com): **#inqry**

###### For bug submission or emails
- Title should be formatted as "**InQRy:** _short description here_"
- Body should contain a longer description with steps to reproduce, screen shots, etc.

Binary file added inqry.icns
Binary file not shown.
Binary file added inqry.ico
Binary file not shown.
Loading

0 comments on commit ae353c0

Please sign in to comment.