Skip to content

Commit

Permalink
final touch ups - still plotting out side the bounds of the app at ti…
Browse files Browse the repository at this point in the history
…mes for some reason, possibly higher than the max g values ?
  • Loading branch information
tallpsmith committed Feb 14, 2014
1 parent 2804045 commit 8215077
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 15 deletions.
12 changes: 3 additions & 9 deletions apps/python/traction-circle/traction-circle.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
updater = 0
numSecondsSpinner = 0


def acMain(ac_version):
global updater, appHeight, appWidth, appWindow, numSecondsSpinner
appWindow = ac.newApp("Traction Circle")
Expand All @@ -24,15 +23,14 @@ def acMain(ac_version):
model = TractionCircleModel()
assetto_corsa = AssettoCorsa()

ac.log("Beginning Spinner creation")
maxTimeSpan = 5
numSecondsSpinner = ac.addSpinner(appWindow, 'Time Span')
maxTimeSpan = 3
numSecondsSpinner = ac.addSpinner(appWindow, 'Time Span(s)')
ac.setPosition(numSecondsSpinner, 0, appHeight - 20)
ac.setSize(numSecondsSpinner, 100, 20)
ac.setRange(numSecondsSpinner, 1, 10)
ac.setValue(numSecondsSpinner, maxTimeSpan)
ac.addOnValueChangeListener(numSecondsSpinner, updateMaxTimeRange)

ac.log("Finished Spinner")
gPlotter = GPlotter(appWidth, appHeight, maxG, maxG)
view = TractionCircleView(appWindow, model, gPlotter)
updater = TractionCircleUpdater(assetto_corsa, view, model, maxTimeRange=maxTimeSpan)
Expand All @@ -43,15 +41,11 @@ def acMain(ac_version):

return "Traction Circle"


def doUpdate(deltaT):
global updater

updater.doUpdate(deltaT)


def updateMaxTimeRange(value):
global updater
ac.log("Setting Num Seconds to {0}".format(str(value)))
updater.setMaxTimeRange(value)

7 changes: 1 addition & 6 deletions apps/python/traction-circle/traction_circle_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,13 @@


class TractionCircleView:
FINAL_COLOUR = {'red': 77, 'green': 184, 'blue': 77} # note that with some start/end values, one of the colour values stepping functions may abort earlier giving uneven array lengths
FINAL_COLOUR = {'red': 77, 'green': 184, 'blue': 77}
START_COLOUR = {'red': 31, 'green': 77, 'blue': 31}

def __init__(self, window, tractionCircleModel, gPlotter):
self.WIDTH = 2.0
self.HEIGHT = 2.0

self.gPlotter = gPlotter
self.label = ac.addLabel(window, '')
ac.setPosition(self.label, 160, 180)

self.tractionCircleModel = tractionCircleModel
self.colourFader = ColourFader(self.START_COLOUR, self.FINAL_COLOUR)

Expand All @@ -33,7 +29,6 @@ def render(self):
ac.glQuad(x, y, self.WIDTH, self.HEIGHT)

ac.glColor3f(1.0, 1.0, 1.0)
ac.setText(self.label, "{0}".format(len(self.tractionCircleModel.dataPoints())))
except Exception as e:
ac.log(str(traceback.format_exc()))

Expand Down

0 comments on commit 8215077

Please sign in to comment.