mirror of
https://github.com/jtgans/g13gui.git
synced 2025-06-20 08:23:50 -04:00
g13gui: bitwidgets: Fix a few bugs in widget
This commit is contained in:
parent
5f5b1e0879
commit
caa316c850
@ -62,17 +62,17 @@ class Widget(Subject, Observer):
|
|||||||
|
|
||||||
def addChild(self, child):
|
def addChild(self, child):
|
||||||
self._children.append(child)
|
self._children.append(child)
|
||||||
self._children.parent = self
|
child.parent = self
|
||||||
child.registerObserver(self, 'valid')
|
child.registerObserver(self, 'valid')
|
||||||
self.addChange(ChangeType.ADD, 'child', child)
|
self.addChange(ChangeType.ADD, 'child', child)
|
||||||
self.notifyChange()
|
self.notifyChanged()
|
||||||
|
|
||||||
def removeChild(self, child):
|
def removeChild(self, child):
|
||||||
child.removeObserver(self)
|
child.removeObserver(self)
|
||||||
self._children.remove(child)
|
self._children.remove(child)
|
||||||
child.parent = None
|
child.parent = None
|
||||||
self.addChange(ChangeType.REMOVE, 'child', child)
|
self.addChange(ChangeType.REMOVE, 'child', child)
|
||||||
self.notifyChange()
|
self.notifyChanged()
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def visible(self):
|
def visible(self):
|
||||||
@ -95,7 +95,7 @@ class Widget(Subject, Observer):
|
|||||||
self.visible = True
|
self.visible = True
|
||||||
|
|
||||||
def draw(self, ctx):
|
def draw(self, ctx):
|
||||||
if self._visible:
|
if self.visible:
|
||||||
for child in self._children:
|
for child in self._children:
|
||||||
if child.visible():
|
if child.visible:
|
||||||
child.draw(ctx)
|
child.draw(ctx)
|
||||||
|
Loading…
Reference in New Issue
Block a user