Skip to content

Commit 1424bd2

Browse files
authored
Merge pull request #2083 from jb0/qtdragon-hd-handler
qtdragon_hd_handler small update for better python compatibility
2 parents a8d1428 + 0d53bee commit 1424bd2

1 file changed

Lines changed: 2 additions & 5 deletions

File tree

share/qtvcp/screens/qtdragon_hd/qtdragon_hd_handler.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,7 @@
1515
from qtvcp.core import Status, Action, Info, Path, Qhal
1616
from qtvcp import logger
1717
from shutil import copyfile
18-
try:
19-
from math import dist, ceil
20-
except:
21-
LOG.error('Is python distutils installed? (sudo apt install python3-distutils')
18+
from math import sqrt, ceil
2219

2320
LOG = logger.getLogger(__name__)
2421
KEYBIND = Keylookup()
@@ -1207,7 +1204,7 @@ def adjust_stacked_widgets(self,requestedIndex):
12071204
def calc_mdi_move_wait_time(self, dest_x, dest_y, wait_buffer_secs=1):
12081205
move_speed = (STATUS.stat.rapidrate * STATUS.get_max_velocity()) / 60
12091206
pos_cur,pos_rel,dtg, = STATUS.get_position()
1210-
move_dist = dist([pos_cur[0],pos_cur[1]], [dest_x,dest_y])
1207+
move_dist = sqrt((dest_x - pos_cur[0]) ** 2 + (dest_y - pos_cur[1]) ** 2)
12111208
return ceil(move_dist / move_speed) + wait_buffer_secs
12121209

12131210

0 commit comments

Comments
 (0)