chaosparrot / talon_hud

Unofficial Talon Head Up Display scripts
72 stars 31 forks source link

Progress Bar Causes HUD to hang when attempting to start development mode #27

Open tararoys opened 2 years ago

tararoys commented 2 years ago

The Problem

In development mode, when you make a change to a talon hud walkthrough (either a markdown or a json walkthrough, it doesn't matter which) Talon HUD walkthrough widgit freezes, loses all text, is unresponsive to mouse clicks and drags, and forces a complete restart of Talon.

Expected behavior is to update the walkthrough step with the change.

The temporary fix:

commenting out the progress bar code, and specifically, lines 418 to line 422, in walkthroughpanel.py makes it so that any changes to a walkthrough appear immediately after saving the change.

            # Draw the progress bar
            #paint.color = self.theme.get_colour("spoken_voice_command_background_colour", "6CC653")
            #rect = ui.Rect(dimensions["rect"].x + progress_bar_offset, dimensions["rect"].y, \
            #    min(dimensions["rect"].width - progress_bar_offset * 2, (dimensions["rect"].width  - progress_bar_offset * 2) * ( current_walkthrough_step.progress.percent * 0.01 )), progress_bar_height)
            #canvas.draw_rect(rect)

This makes everything function normally at the cost of disabling the progress bar. Progress bar can be re-enabled when you are not in development mode.

Bug reproduction

On windows 10:

  1. after saying head up develompent start
  2. open any walkthrough
  3. Open any walkthrough in vscode
  4. make a change to the walkthrough file in vscode
  5. The walkthrough panel will turn blank, become unresponsive, and refuse voice commands and mouse clicks

The following error appears in the log

AttributeError: 'NoneType' object has no attribute 'percent'
2022-06-02 10:21:49 ERROR cb error topic="draw" cb=<bound method BaseWidget.draw_cycle of <user.talon_hud.widgets.walkthroughpanel.HeadUpWalkthroughPanel object at 0x00000000300E69A0>>
    9:                            talon\canvas.py:17 | 
    8:                            talon\canvas.py:164| 
    7:                talon\scripting\dispatch.py:144| 
    6:                talon\scripting\dispatch.py:135| 
    5: ----------------------------------------------# [stack splice]
    4:                    talon\scripting\rctx.py:233| # 'draw' user.talon_hud.reloader:draw_cycle()
    3:              user\talon_hud\base_widget.py:217| continue_drawing = self.draw(canvas)
    2:            user\talon_hud\layout_widget.py:168| continue_drawing = self.draw_content(c..
    1: user\talon_hud\widgets\walkthroughpanel.py:421| min(dimensions["rect"].width - progress_bar_offset * 2, (dimensions["rect"].width  - progress_bar_offset * 2) * ( current_walkthrough_step.progress.percent * ..
AttributeError: 'NoneType' object has no attribute 'percent'
2022-06-02 10:21:49 ERROR cb error topic="draw" cb=<bound method BaseWidget.draw_cycle of <user.talon_hud.widgets.walkthroughpanel.HeadUpWalkthroughPanel object at 0x00000000300E69A0>>
    9:                            talon\canvas.py:17 | 
    8:                            talon\canvas.py:164| 
    7:                talon\scripting\dispatch.py:144| 
    6:                talon\scripting\dispatch.py:135| 
    5: ----------------------------------------------# [stack splice]
    4:                    talon\scripting\rctx.py:233| # 'draw' user.talon_hud.reloader:draw_cycle()
    3:              user\talon_hud\base_widget.py:217| continue_drawing = self.draw(canvas)
    2:            user\talon_hud\layout_widget.py:168| continue_drawing = self.draw_content(c..
    1: user\talon_hud\widgets\walkthroughpanel.py:421| min(dimensions["rect"].width - progress_bar_offset * 2, (dimensions["rect"].width  - progress_bar_offset * 2) * ( current_walkthrough_step.progress.percent * ..
AttributeError: 'NoneType' object has no attribute 'percent'
chaosparrot commented 1 year ago

Just leaving a few links to your commits here so I can implement them later: ttps://github.com/tararoys/talon_hud/commit/bb2c74156c0c01e0a5a771b2719a89c341c74c37

https://github.com/tararoys/talon_hud/commit/ca3d3d6690200639207fa3cc22f044a899f958a4