Skip to content

Commit

Permalink
Icon size can be chaged now
Browse files Browse the repository at this point in the history
  • Loading branch information
vilim committed Dec 3, 2018
1 parent d119f3d commit fab9d91
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions lightparam/gui/controls.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,23 +88,23 @@ def update_param(self):

class ControlToggleIcon(QToolButton, Control):
"""A toggle button for a boolean parameter"""
def __init__(self, parametrized, name, icon_on=None, icon_off=None, action_on=None, action_off=None, **kwargs):
def __init__(self, parametrized, name, icon_on=None, icon_off=None,
action_on=None, action_off=None, icon_size=32, **kwargs):
super().__init__(parametrized=parametrized, name=name)
self.text_on = action_on or name+" off"
self.text_off = action_off or action_on or name+" on"
self.icon_on = icon_on
self.icon_off = icon_off or self.icon_on
current_text = self.text_on if self.param.value else self.text_off

print("Here")

if self.icon_on is None:
self.setText(current_text)
else:
self.setIcon(self.icon_on if self.param.value else self.icon_off)
self.setToolTip(current_text)
self.setFixedSize(QSize(48, 48))
self.setIconSize(QSize(32, 32))
bs = int(round(icon_size*1.5))
self.setFixedSize(QSize(bs, bs))
self.setIconSize(QSize(icon_size, icon_size))

self.setCheckable(True)
self.setChecked(self.param.value)
Expand Down

0 comments on commit fab9d91

Please sign in to comment.