wojtryb / Shortcut-Composer

Krita plugin for creating complex keyboard shortcuts
GNU General Public License v3.0
261 stars 9 forks source link

ZeroDivisionError: float division by zero #30

Closed Theraa0 closed 1 year ago

Theraa0 commented 1 year ago

I just came across this program and followed the installation, but I keep getting this error and the program is not working. This is from the error box:

`ZeroDivisionError Python 3.10.9: /usr/bin/python3 Sat Feb 4 01:36:04 2023

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

/home/thera/.local/share/krita/pykrita/shortcut_composer/shortcut_composer.py in createActions(self=, window=) 40 41 self._manager = ActionManager(window) 42 self._reload_composer() 43 44 def _create_reload_action(self, window) -> QWidgetAction: self = self._reload_composer = <bound method ShortcutComposer._reload_composer ...poser.shortcut_composer.ShortcutComposer object>>

/home/thera/.local/share/krita/pykrita/shortcut_composer/shortcut_composer.py in _reload_composer(self=) 59 60 def _reload_composer(self) -> None: 61 """Reload all core actions.""" 62 for action in create_actions(): 63 self._manager.bind_action(action) action undefined global create_actions =

/home/thera/.local/share/krita/pykrita/shortcut_composer/actions.py in create_actions() 225 # Use pie menu to pick one of presets from tag specified in settings. 226 # Set tool to FREEHAND BRUSH if current tool does not allow to paint 227 templates.PieMenu( 228 name="Pick brush presets (green)", 229 controller=controllers.PresetController(), global templates = <module 'templates' from '/home/thera/.local/sha...pykrita/shortcut_composer/templates/init.py'> templates.PieMenu = <class 'templates.pie_menu.PieMenu'> name undefined controller undefined global controllers = <module 'core_components.controllers' from '/hom...omposer/core_components/controllers/init.py'> controllers.PresetController = <class 'core_components.controllers.view_controllers.PresetController'> global instructions = <module 'core_components.instructions' from '/ho...mposer/core_components/instructions/init.py'> instructions.SetBrushOnNonPaintable = <class 'core_components.instructions.set_brush_strategy.SetBrushOnNonPaintable'> values undefined global TagConfigValues = <class 'data_components.writable_values.TagConfigValues'> global Config = <enum 'Config'> Config.TAG_GREEN = <Config.TAG_GREEN: 'Tag (green)'> Config.TAG_GREEN_VALUES = <Config.TAG_GREEN_VALUES: 'Tag (green) values'> background_color undefined global QColor = <class 'PyQt5.QtGui.QColor'> active_color undefined

/home/thera/.local/share/krita/pykrita/shortcut_composer/templates/pie_menu.py in init(self=, name='Pick brush presets (green)', controller=, values=['Basic mix soft', 'Basic mix', 'Basic tip defau...Eraser circle', 'Ink gpen 10', 'Smudge textured'], instructions=[], pie_radius_scale=1.0, icon_radius_scale=1.0, background_color=, active_color=, short_vs_long_press_time=None) 93 94 self._labels = self._create_labels(values) 95 self._style = PieStyle( 96 pie_radius_scale=pie_radius_scale, 97 icon_radius_scale=icon_radius_scale, self = self._style undefined global PieStyle = <class 'templates.pie_menu_utils.pie_style.PieStyle'> pie_radius_scale = 1.0 icon_radius_scale = 1.0 icons_amount undefined builtinlen = self._labels = [] background_color = active_color =

/home/thera/.local/share/krita/pykrita/shortcut_composer/templates/pie_menu_utils/pie_style.py in init(self=PieStyle(), pie_radius_scale=1.0, icon_radius_scale=1.0, icons_amount=0, background_color=, active_color=) 51 * Config.PIE_GLOBAL_SCALE.read()) 52 53 self.icon_radius = self._pick_icon_radius() 54 self.widget_radius = self.pie_radius + self.icon_radius 55 self.deadzone_radius = self._pick_deadzone_radius() self = PieStyle() self.icon_radius undefined self._pick_icon_radius = <bound method PieStyle._pick_icon_radius of PieStyle()>

/home/thera/.local/share/krita/pykrita/shortcut_composer/templates/pie_menu_utils/pie_style.py in _pick_icon_radius(self=PieStyle()) 79 Config.PIE_ICON_GLOBAL_SCALE.read() 80 ) 81 max_icon_size = round(self.pie_radius math.pi / self._icons_amount) 82 return min(icon_radius, max_icon_size) 83 max_icon_size undefined builtinround = self = PieStyle() self.pie_radius = 124 global math = <module 'math' from '/usr/lib/python3.10/lib-dynload/math.cpython-310-x86_64-linux-gnu.so'> math.pi = 3.141592653589793 self._icons_amount = 0 ZeroDivisionError: float division by zero cause = None class = <class 'ZeroDivisionError'> context = None delattr = <method-wrapper 'delattr' of ZeroDivisionError object> dict = {} dir = doc = 'Second argument to a division or modulo operation was zero.' eq = <method-wrapper 'eq' of ZeroDivisionError object> format = ge = <method-wrapper 'ge' of ZeroDivisionError object> getattribute = <method-wrapper 'getattribute' of ZeroDivisionError object> gt = <method-wrapper 'gt' of ZeroDivisionError object> hash = <method-wrapper 'hash' of ZeroDivisionError object> init = <method-wrapper 'init' of ZeroDivisionError object> init_subclass = <built-in method init_subclass of type object> le = <method-wrapper 'le' of ZeroDivisionError object> lt = <method-wrapper 'lt' of ZeroDivisionError object> ne = <method-wrapper 'ne' of ZeroDivisionError object> new = reduce = reduce_ex = <built-in method reduce_ex of ZeroDivisionError object> repr = <method-wrapper 'repr' of ZeroDivisionError object> setattr = <method-wrapper 'setattr' of ZeroDivisionError object> setstate = sizeof = str = <method-wrapper 'str' of ZeroDivisionError object> subclasshook = __suppress_context = False traceback__ = args = ('float division by zero',) with_traceback =

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

Traceback (most recent call last): File "/home/thera/.local/share/krita/pykrita/shortcut_composer/shortcut_composer.py", line 42, in createActions self._reload_composer() File "/home/thera/.local/share/krita/pykrita/shortcut_composer/shortcut_composer.py", line 62, in _reload_composer for action in create_actions(): File "/home/thera/.local/share/krita/pykrita/shortcut_composer/actions.py", line 227, in create_actions templates.PieMenu( File "/home/thera/.local/share/krita/pykrita/shortcut_composer/templates/pie_menu.py", line 95, in init self._style = PieStyle( File "/home/thera/.local/share/krita/pykrita/shortcut_composer/templates/pie_menu_utils/pie_style.py", line 53, in init self.icon_radius = self._pick_icon_radius() File "/home/thera/.local/share/krita/pykrita/shortcut_composer/templates/pie_menu_utils/pie_style.py", line 81, in _pick_icon_radius max_icon_size = round(self.pie_radius * math.pi / self._icons_amount) ZeroDivisionError: float division by zero

`

wojtryb commented 1 year ago

Hi, I made a 1.1.1 release today to publish fix to this and some other issues. Please download and install the plugin again. Thank you for reporting the issue.

Theraa0 commented 1 year ago

Alright, thank you!