Skip to content

Commit c44b066

Browse files
resizable works... fullscreen has some gotchas... I don't know why
1 parent 4c54987 commit c44b066

File tree

2 files changed

+26
-11
lines changed

2 files changed

+26
-11
lines changed

cocos/widget_buttons.py

Lines changed: 25 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,7 @@ class WButtonGroup( WObject ):
193193
def __init__(self, exclusive=True, *args, **kw):
194194
super(WButtonGroup, self).__init__(*args, **kw)
195195
self._exclusive = exclusive
196+
self._dirty = False
196197

197198
def on_mouse_click_proxy( self, widget, x, y, buttons, modifiers):
198199

@@ -208,22 +209,36 @@ def on_mouse_click_proxy( self, widget, x, y, buttons, modifiers):
208209
w.checked = False
209210
w.on_toggle()
210211

212+
def add( self, *args, **kw ):
213+
self._dirty = True
214+
super( WButtonGroup, self).add( *args, **kw )
215+
211216
def on_mouse_click( self, x, y, buttons, modifiers ):
212217
# ignore
213218
pass
214219

215220
def _get_width( self ):
216-
w = 0
217-
for z,widget in self.children:
218-
x,y = widget.position
219-
w = max(w,x + widget.width)
220-
return w
221+
if self._dirty:
222+
h = w = 0
223+
for z,widget in self.children:
224+
x,y = widget.position
225+
w = max(w,x + widget.width)
226+
h = max(h,y + widget.height )
227+
self._dirty = False
228+
self._width = w
229+
self._height = h
230+
return self._width
221231
def _get_height( self ):
222-
h = 0
223-
for z,widget in self.children:
224-
x,y = widget.position
225-
h = max(h,y + widget.height )
226-
return h
232+
if self._dirty:
233+
h = w = 0
234+
for z,widget in self.children:
235+
x,y = widget.position
236+
w = max(w,x + widget.width)
237+
h = max(h,y + widget.height )
238+
self._dirty = False
239+
self._width = w
240+
self._height = h
241+
return self._height
227242

228243
def _get_exclusive( self ):
229244
return self._exclusive

tiless-editor/tiless_editor.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -430,7 +430,7 @@ def __repr__(self):
430430
if options.fullscreen:
431431
director.init(fullscreen=options.fullscreen)
432432
else:
433-
director.init(width=int(options.width), height=int(options.height), do_not_scale=True)
433+
director.init(width=int(options.width), height=int(options.height), do_not_scale=True, resizable=True)
434434

435435
editor = TilessEditor(options.filename, options.tilesdir)
436436
editor_scene = Scene(editor)

0 commit comments

Comments
 (0)