Skip to content

Commit 94b824e

Browse files
committed
work on help management
1 parent 810eb78 commit 94b824e

File tree

5 files changed

+109
-0
lines changed

5 files changed

+109
-0
lines changed

Background/messageProcessor.py

+1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ def start(self):
1919
if time.time()-self.data.lastChecked > 60*60:
2020
self.data.lastChecked = time.time()
2121
self.data.releaseManager.checkForLatestPyRelease()
22+
self.data.helpManager.checkForUpdatedHelp()
2223
# process messages while queue is not empty. Everything else is on hold until queue is cleared.
2324
while ( not self.data.message_queue.empty() ): # if there is new data to be read
2425
message = self.data.message_queue.get()

Connection/nonVisibleWidgets.py

+4
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
from Background.webcamVideoStream import WebcamVideoStream
1919
from Boards.boardManager import BoardManager
2020
from ReleaseManager.releaseManager import ReleaseManager
21+
from HelpManager.helpManager import HelpManager
2122

2223
class NonVisibleWidgets(MakesmithInitFuncs):
2324
"""
@@ -42,6 +43,7 @@ class NonVisibleWidgets(MakesmithInitFuncs):
4243
gpioActions = GPIOActions()
4344
boardManager = BoardManager()
4445
releaseManager = ReleaseManager()
46+
helpManager = HelpManager()
4547

4648
def setUpData(self, data):
4749
"""
@@ -72,6 +74,7 @@ def setUpData(self, data):
7274
data.gpioActions = self.gpioActions
7375
data.boardManager = self.boardManager
7476
data.releaseManager = self.releaseManager
77+
data.helpManager = self.helpManager
7578

7679
if hasattr(sys, '_MEIPASS'):
7780
data.platform = "PYINSTALLER"
@@ -126,6 +129,7 @@ def setUpData(self, data):
126129
self.boardManager.setUpData(data)
127130
self.boardManager.initializeNewBoard()
128131
self.releaseManager.setUpData(data)
132+
self.helpManager.setUpData(data)
129133

130134
#set up kinematics with current settings
131135
self.holeyKinematics.initializeSettings()

Documentation/boardManagement.md

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# Board Management
2+
3+
## Concept
4+
5+
Board management as implemented in WebControl allows the user to track the areas of a given board that have been cut or otherwise marked by executing gcode. The system tracks cut areas at a 1-inch square resolution. That is, a standard 4-foot by 8-foot sheet of plywood is tracked by a 48 x 96 grid.
6+
7+
## Functions
8+
9+
### Create/Edit Board
10+
11+
This function allows the user to define the size (width, height, thickness) of a board, provide identifying information (board ID, material type), and the position of center of the board on the frame.
12+
13+
Board Details:
14+
The "Board ID" can be any name or other identifier the user desires to give the board (e.g., Board 1, A1, MDF-1, etc.) The "Material" can be any description the user desires to enter (e.g, MDF, Plywood, Acrylic, Depleted Uranium, etc.)
15+
16+
Board Dimensions:
17+
The units of the board is based upon the unit setting for the machine. So if you have it set to metrics, your units will be reported in metric.. if in imperial, they will be reported in imperial.
18+
19+
Board Positions:
20+
Center X (horizontal) and Center Y (vertical) position of the center of the board with respect to the frame. A 4-foot x 8-foot sheet of plywood perfectly aligned on a 'standard' Maslow would have a Center X and Center Y of 0, 0.
21+
22+
Align Board to Router allows the user to use the router's current position to indicate where the board is located. For boards that are not full sheet sizes, this makes it easy to align the board for cutting. For example, if the router is located at 12, 0 (1-foot to the right of center) and the board is perfectly centered under the router bit, pressing the 'Center' button will set the Center X and Center Y of the board to 12, 0. If, instead, the top right corner of a 1-foot board is located directly under the router bit, pressing 'Top Right' will set the Center X and Center Y of the board to 6, 0 (6-inches to the right of the center).
23+
24+
### Process GCode
25+
26+
The GCode that has been loaded will be used to mark areas on the board that have been cut. Obviously, this would be performed after you actually perform a cut.
27+
28+
### Open / Save Board
29+
30+
Allows user to save board data to the drive and open previously saved board data.
31+
32+
### Trim GCode
33+
34+
In the event the user cuts part of the board off (i.e., trims an edge), this function allows for the board data to be updated. For example, if the user cuts 1-foot off the top of the board, the user can enter 12 under 'Trim Top' and the top 12-inches will be removed from the board data. Note, this doesn't affect the value of Center X and Center Y.
35+
36+
### Clear Board
37+
38+
Clears all cut information from current board.

HelpManager/__init__.py

Whitespace-only changes.

HelpManager/helpManager.py

+66
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
from DataStructures.makesmithInitFuncs import MakesmithInitFuncs
2+
import re
3+
import requests
4+
from github import Github
5+
6+
class HelpManager(MakesmithInitFuncs):
7+
8+
def __init__(self):
9+
pass
10+
11+
releases = None
12+
latestRelease = None
13+
14+
def getReleases(self):
15+
return self.releases
16+
17+
def getLatestRelease(self):
18+
return self.latestRelease
19+
20+
def checkForUpdatedHelp(self):
21+
self.getWikiUrls()
22+
return True
23+
24+
def getWikiUrls(self):
25+
26+
url = 'https://api.github.com/graphql'
27+
json = {'query': '{ viewer { repositories(first: 30) { totalCount pageInfo { hasNextPage endCursor } edges { node { name } } } } }'}
28+
api_token = "your api token here..."
29+
headers = {'Authorization': 'token %s' % api_token}
30+
31+
r = requests.post(url=url, json=json)
32+
print(r.text)
33+
34+
'''
35+
g = Github()
36+
self.wiki = g.get_repo("madgrizzle/WebControl.wiki.repo")
37+
print(self.wiki)
38+
39+
latest = 0
40+
latestRelease = None
41+
type = self.data.pyInstallType
42+
platform = self.data.pyInstallPlatform
43+
for release in self.releases:
44+
try:
45+
tag_name = re.sub(r'[v]', r'', release.tag_name)
46+
# print(tag_name)
47+
if float(tag_name) > latest:
48+
latest = float(tag_name)
49+
self.latestRelease = release
50+
51+
except:
52+
print("error parsing tagname")
53+
print(latest)
54+
if latest > self.data.pyInstallCurrentVersion:
55+
if self.latestRelease is not None:
56+
print(self.latestRelease.tag_name)
57+
assets = self.latestRelease.get_assets()
58+
for asset in assets:
59+
if asset.name.find(type) != -1 and asset.name.find(platform) != -1:
60+
print(asset.name)
61+
print(asset.url)
62+
self.data.ui_queue1.put("Action", "pyinstallUpdate", "on")
63+
self.data.pyInstallUpdateAvailable = True
64+
self.data.pyInstallUpdateBrowserUrl = asset.browser_download_url
65+
self.data.pyInstallUpdateVersion = latest
66+
'''

0 commit comments

Comments
 (0)