TabPad icon indicating copy to clipboard operation
TabPad copied to clipboard

TypeError: arguments did not match any overloaded call

Open jphaupt opened this issue 2 years ago • 1 comments

Hi, I understand this project is quite old now, but I don't know of any similar project/package out there.

Anyway, I am trying to run TabPad on a 2-in-1 laptop running Fedora (so my install was a little different), but am running into this problem when I run DISPLAY=:0 sudo python3 TabPad.py (without DISPLAY=:0 it fails to connect to the display):

QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-root'
Traceback (most recent call last):
  File "/home/jph/software/TabPad/TabPad.py", line 883, in <module>
    main()
  File "/home/jph/software/TabPad/TabPad.py", line 879, in main
    ex = TabPad()
         ^^^^^^^^
  File "/home/jph/software/TabPad/TabPad.py", line 56, in __init__
    self.initUI()
  File "/home/jph/software/TabPad/TabPad.py", line 68, in initUI
    self.create_sticks(k, v[0], v[1], (v[2], v[3]), v[4], [v[6], v[7]])
  File "/home/jph/software/TabPad/TabPad.py", line 282, in create_sticks
    nub.resize(nub_width, nub_height)
TypeError: arguments did not match any overloaded call:
  resize(self, a0: QSize): argument 1 has unexpected type 'float'
  resize(self, w: int, h: int): argument 1 has unexpected type 'float'

Any ideas how to debug this? Thanks!

jphaupt avatar Dec 17 '23 12:12 jphaupt

i know that it is almost 4 months old, but...

you can use this patch
diff --git a/TabPad.py b/TabPad.py
index 8c9c396..dc2a460 100755
--- a/TabPad.py
+++ b/TabPad.py
@@ -278,7 +278,7 @@ class TabPad(QWidget):
 
 		if override_button_size:
 			stick_widget.resize(*btnsize)
-			nub_width, nub_height = btnsize[0]/2, btnsize[1]/2
+			nub_width, nub_height = btnsize[0]//2, btnsize[1]//2
 			nub.resize(nub_width, nub_height)
 			dz_size = self.percentconvertor(deadzone, btnsize[0])
 			dz.resize(dz_size, dz_size)
@@ -376,8 +376,8 @@ class TabPad(QWidget):
 		eventx = event_pos.x()
 		eventy = event_pos.y()
 		if ((eventx - widget_xc)*(eventx - widget_xc) + (eventy - widget_yc)*(eventy - widget_yc)) < r*r:
-			x = widget_startx + (event_pos.x() - widget_startx)/2
-			y = widget_starty + (event_pos.y() - widget_starty)/2
+			x = widget_startx + (event_pos.x() - widget_startx)//2
+			y = widget_starty + (event_pos.y() - widget_starty)//2
 			nub.move(x,y)
 			self.execute_nub_commands(widget, widget_xc, widget_yc, \
 				widget_startx, widget_endx, widget_starty, widget_endy, name, eventx, eventy)
diff --git a/TabPadUi.py b/TabPadUi.py
index f27d5ab..fde6a7a 100755
--- a/TabPadUi.py
+++ b/TabPadUi.py
@@ -89,8 +89,8 @@ class MainSettings(QDialog):
 		vbox.addLayout(hbox)
 		self.setLayout(vbox)
 	
-		w, h = self.screen_width*.9, self.screen_height*.8
-		self.setGeometry((self.screen_width-w)/2, (self.screen_height-h)/2, w, h)
+		w, h = int(self.screen_width*.9), int(self.screen_height*.8)
+		self.setGeometry(int(self.screen_width-w)//2, int(self.screen_height-h)//2, w, h)
 		self.setWindowTitle('Settings')
 		# self.show()
 
@@ -371,7 +371,7 @@ class Dialog(QDialog):
 		else:
 			pwidth = self.parent.parent.frameGeometry().width()
 			pheight = self.parent.frameGeometry().height()
-		self.setGeometry((pwidth-width)/2, (pheight-height)/2, width, height)
+		self.setGeometry((pwidth-width)//2, (pheight-height)//2, width, height)
 		self.setWindowTitle(self.window_title)
 
 	def close_settings(self):
@@ -663,8 +663,8 @@ class LayoutSettings(QDialog):
 		vbox.addLayout(hbox)
 		self.setLayout(vbox)
 		
-		w, h = self.screen_width*.9, self.screen_height*.8
-		self.setGeometry((self.screen_width-w)/2, (self.screen_height-h)/2, w, h)
+		w, h = int(self.screen_width*.9), int(self.screen_height*.8)
+		self.setGeometry((self.screen_width-w)//2, (self.screen_height-h)//2, w, h)
 		self.setWindowTitle('Change Gamepad Layout')
 		# self.show()
 

not making a PR since project is dead for 7 years...

askorbinovaya-kislota avatar Apr 07 '24 23:04 askorbinovaya-kislota