Kapyia/KanvasBuddy

Can't run KanvasBuddy v0.4.1

Opened this issue · 1 comments

Getting the below error trying to run v0.4.1 on Krita v4.1.5 from Windows 10 (x86_64)

AttributeError
Python 3.6.2: python
Mon Apr 20 13:13:27 2020

A problem occurred in a Python script.  Here is the sequence of
function calls leading up to the error, in the order they occurred.

C:\Users\user\AppData\Roaming\krita\pykrita\kanvasbuddy\kanvasbuddy.py in launchInterface(self=<kanvasbuddy.kanvasbuddy.KanvasBuddy object>)
54             # importlib.reload(uikanvasbuddy) # FOR TESTING ONLY
55             self.isActive = True
56             ui = uikanvasbuddy.UIKanvasBuddy(self)
57             ui.launch()
58 
ui undefined
global uikanvasbuddy = <module 'kanvasbuddy.uikanvasbuddy' from 'C:\\Us...\\krita\\pykrita\\kanvasbuddy\\uikanvasbuddy.py'>
uikanvasbuddy.UIKanvasBuddy = <class 'kanvasbuddy.uikanvasbuddy.UIKanvasBuddy'>
self = <kanvasbuddy.kanvasbuddy.KanvasBuddy object>

C:\Users\user\AppData\Roaming\krita\pykrita\kanvasbuddy\uikanvasbuddy.py in __init__(self=<kanvasbuddy.uikanvasbuddy.UIKanvasBuddy object>, kbuddy=<kanvasbuddy.kanvasbuddy.KanvasBuddy object>)
61         # SET UP PANELS
62         self.panelStack = pnlstk.KBPanelStack(self)
63         self.initPanels(config['PANELS'], jsonData['panels'])
64         self.layout().addWidget(self.panelStack)
65 
self = <kanvasbuddy.uikanvasbuddy.UIKanvasBuddy object>
self.initPanels = <bound method UIKanvasBuddy.initPanels of <kanvasbuddy.uikanvasbuddy.UIKanvasBuddy object>>
config = <configparser.ConfigParser object>
jsonData = {'canvasOptions': {'canvasOnly': {'icon': 'light_document-new', 'id': 'view_show_canvas_only'}, 'instantPreview': {'icon': 'light_visible', 'id': 'level_of_detail_mode'}, 'mirrorCanvas': {'icon': 'light_mirror-view', 'id': 'mirror_canvas'}, 'resetZoom': {'icon': 'light_zoom-original', 'id': 'zoom_to_100pct'}, 'wrapAround': {'icon': 'light_view-grid', 'id': 'wrap_around_mode'}}, 'panels': {'advancedColor': {'icon': 'light_krita_tool_color_picker', 'id': 'ColorSelectorNg', 'size': [290, 290]}, 'animation': {'icon': 'light_addblankframe', 'id': 'AnimationDocker', 'size': []}, 'arrange': {'icon': '24_light_align-horizontal-center', 'id': 'ArrangeDocker', 'size': [100, 100]}, 'artisticColor': {'icon': 'light_wheel-sectors', 'id': 'ArtisticColorSelector', 'size': []}, 'comicsProject': {'icon': 'light_select-all', 'id': 'comics_project_manager_docker', 'size': []}, 'digitalColors': {'icon': 'light_krita_tool_gradient', 'id': 'DigitalMixer', 'size': []}, 'history': {'icon': 'light_fileLayer', 'id': 'History', 'size': []}, 'layers': {'icon': 'light_duplicatelayer', 'id': 'KisLayerBox', 'size': []}, 'lut': {'icon': 'light_color-to-alpha', 'id': 'LutDocker', 'size': []}, 'onionSkins': {'icon': 'light_onion_skin_options', 'id': 'OnionSkinsDocker', 'size': [100, 100]}, ...}}

C:\Users\user\AppData\Roaming\krita\pykrita\kanvasbuddy\uikanvasbuddy.py in initPanels(self=<kanvasbuddy.uikanvasbuddy.UIKanvasBuddy object>, config=<Section: PANELS>, data={'advancedColor': {'icon': 'light_krita_tool_color_picker', 'id': 'ColorSelectorNg', 'size': [290, 290]}, 'animation': {'icon': 'light_addblankframe', 'id': 'AnimationDocker', 'size': []}, 'arrange': {'icon': '24_light_align-horizontal-center', 'id': 'ArrangeDocker', 'size': [100, 100]}, 'artisticColor': {'icon': 'light_wheel-sectors', 'id': 'ArtisticColorSelector', 'size': []}, 'comicsProject': {'icon': 'light_select-all', 'id': 'comics_project_manager_docker', 'size': []}, 'digitalColors': {'icon': 'light_krita_tool_gradient', 'id': 'DigitalMixer', 'size': []}, 'history': {'icon': 'light_fileLayer', 'id': 'History', 'size': []}, 'layers': {'icon': 'light_duplicatelayer', 'id': 'KisLayerBox', 'size': []}, 'lut': {'icon': 'light_color-to-alpha', 'id': 'LutDocker', 'size': []}, 'onionSkins': {'icon': 'light_onion_skin_options', 'id': 'OnionSkinsDocker', 'size': [100, 100]}, ...})
81         for entry in config:
82             if config.getboolean(entry):
83                 self.panelStack.loadPanel(data[entry])
84 
85 
self = <kanvasbuddy.uikanvasbuddy.UIKanvasBuddy object>
self.panelStack = <kanvasbuddy.kbpanelstack.KBPanelStack object>
self.panelStack.loadPanel = <bound method KBPanelStack.loadPanel of <kanvasbuddy.kbpanelstack.KBPanelStack object>>
data = {'advancedColor': {'icon': 'light_krita_tool_color_picker', 'id': 'ColorSelectorNg', 'size': [290, 290]}, 'animation': {'icon': 'light_addblankframe', 'id': 'AnimationDocker', 'size': []}, 'arrange': {'icon': '24_light_align-horizontal-center', 'id': 'ArrangeDocker', 'size': [100, 100]}, 'artisticColor': {'icon': 'light_wheel-sectors', 'id': 'ArtisticColorSelector', 'size': []}, 'comicsProject': {'icon': 'light_select-all', 'id': 'comics_project_manager_docker', 'size': []}, 'digitalColors': {'icon': 'light_krita_tool_gradient', 'id': 'DigitalMixer', 'size': []}, 'history': {'icon': 'light_fileLayer', 'id': 'History', 'size': []}, 'layers': {'icon': 'light_duplicatelayer', 'id': 'KisLayerBox', 'size': []}, 'lut': {'icon': 'light_color-to-alpha', 'id': 'LutDocker', 'size': []}, 'onionSkins': {'icon': 'light_onion_skin_options', 'id': 'OnionSkinsDocker', 'size': [100, 100]}, ...}
entry = 'presetChooser'

C:\Users\user\AppData\Roaming\krita\pykrita\kanvasbuddy\kbpanelstack.py in loadPanel(self=<kanvasbuddy.kbpanelstack.KBPanelStack object>, data={'icon': 'light_paintop_settings_01', 'id': 'PresetDocker', 'size': [260, 335]})
56         ID = data['id']
57         if ID == 'PresetDocker': # This is ugly, but necessary until the Krita API opens a proper 'presetChanged' signal
58             pc = KBPresetChooser()
59             pc.presetSelected.connect(self.brushPresetChanged)
60             pc.presetClicked.connect(self.brushPresetChanged)
pc undefined
global KBPresetChooser = <class 'kanvasbuddy.kbpresetchooser.KBPresetChooser'>

C:\Users\user\AppData\Roaming\krita\pykrita\kanvasbuddy\kbpresetchooser.py in __init__(self=<kanvasbuddy.kbpresetchooser.KBPresetChooser object>, parent=None)
23         super(KBPresetChooser, self).__init__(parent)
24         # Hide buttons deemed excessive for this plugin
25         self.layout().itemAt(0).widget().layout().itemAt(4).itemAtPosition(0,0).widget().hide()
26         self.layout().itemAt(0).widget().layout().itemAt(4).itemAtPosition(0,1).widget().hide()
27 
self = <kanvasbuddy.kbpresetchooser.KBPresetChooser object>
self.layout = <built-in method layout of KBPresetChooser object>
).itemAt undefined
AttributeError: 'QLayout' object has no attribute 'itemAtPosition'
	__cause__ = None
	__class__ = <class 'AttributeError'>
	__context__ = None
	__delattr__ = <method-wrapper '__delattr__' of AttributeError object>
	__dict__ = {}
	__dir__ = <built-in method __dir__ of AttributeError object>
	__doc__ = 'Attribute not found.'
	__eq__ = <method-wrapper '__eq__' of AttributeError object>
	__format__ = <built-in method __format__ of AttributeError object>
	__ge__ = <method-wrapper '__ge__' of AttributeError object>
	__getattribute__ = <method-wrapper '__getattribute__' of AttributeError object>
	__gt__ = <method-wrapper '__gt__' of AttributeError object>
	__hash__ = <method-wrapper '__hash__' of AttributeError object>
	__init__ = <method-wrapper '__init__' of AttributeError object>
	__init_subclass__ = <built-in method __init_subclass__ of type object>
	__le__ = <method-wrapper '__le__' of AttributeError object>
	__lt__ = <method-wrapper '__lt__' of AttributeError object>
	__ne__ = <method-wrapper '__ne__' of AttributeError object>
	__new__ = <built-in method __new__ of type object>
	__reduce__ = <built-in method __reduce__ of AttributeError object>
	__reduce_ex__ = <built-in method __reduce_ex__ of AttributeError object>
	__repr__ = <method-wrapper '__repr__' of AttributeError object>
	__setattr__ = <method-wrapper '__setattr__' of AttributeError object>
	__setstate__ = <built-in method __setstate__ of AttributeError object>
	__sizeof__ = <built-in method __sizeof__ of AttributeError object>
	__str__ = <method-wrapper '__str__' of AttributeError object>
	__subclasshook__ = <built-in method __subclasshook__ of type object>
	__suppress_context__ = False
	__traceback__ = <traceback object>
	args = ("'QLayout' object has no attribute 'itemAtPosition'",)
	with_traceback = <built-in method with_traceback of AttributeError object>

The above is a description of an error in a Python program.  Here is
the original traceback:

Traceback (most recent call last):
File "C:\Users\user\AppData\Roaming\krita\pykrita\kanvasbuddy\kanvasbuddy.py", line 56, in launchInterface
	ui = uikanvasbuddy.UIKanvasBuddy(self)
File "C:\Users\user\AppData\Roaming\krita\pykrita\kanvasbuddy\uikanvasbuddy.py", line 63, in __init__
	self.initPanels(config['PANELS'], jsonData['panels'])
File "C:\Users\user\AppData\Roaming\krita\pykrita\kanvasbuddy\uikanvasbuddy.py", line 83, in initPanels
	self.panelStack.loadPanel(data[entry])
File "C:\Users\user\AppData\Roaming\krita\pykrita\kanvasbuddy\kbpanelstack.py", line 58, in loadPanel
	pc = KBPresetChooser()
File "C:\Users\user\AppData\Roaming\krita\pykrita\kanvasbuddy\kbpresetchooser.py", line 25, in __init__
	self.layout().itemAt(0).widget().layout().itemAt(4).itemAtPosition(0,0).widget().hide()
AttributeError: 'QLayout' object has no attribute 'itemAtPosition'

Just go to the line 25 and erase or comment a coupe of lines, if you read in the file comments it will tell you that it hides some buttons. QWidgetItem doesn't have the attribute itemAtPosition and for a little research I did it seems QWidgetItem is from Qt.io a framework. After you comment(put the symbol # before the line) and save the file, it will launch.