My favorites | Sign in
Project Home Downloads Issues
READ-ONLY: This project has been archived. For more information see this post.
Search
for
  Advanced search   Search tips   Subscriptions
Issue 231: Removing a MTInnerWindow from a MTKinetic causes a crash
1 person starred this issue and may be notified of changes. Back to list
Status:  Done
Owner:  txprog
Closed:  Jun 2010


 
Reported by jaybradl...@gmail.com, Apr 7, 2010
What steps will reproduce the problem?
1. Add a MTKinetic object to the root_window
2. Add a MTInnerWindow to the MTKinetic object
3. Click on the remove window button

What is the expected output? What do you see instead?

The inner window should disappear without an exception but this error is given:
[INFO   ] [Base    ] Leaving application in progress...
Traceback (most recent call last):
  File "start.py", line 277, in <module>
    runTouchApp()
  File "/usr/lib/python2.6/site-packages/pymt/base.py", line 352, in
runTouchApp
    pymt_window.mainloop()
  File "/usr/lib/python2.6/site-packages/pymt/ui/window/win_pygame.py",
line 124, in mainloop
    evloop.idle()
  File "/usr/lib/python2.6/site-packages/pymt/base.py", line 201, in idle
    pymt_window.dispatch_event('on_draw')
  File "/usr/lib/python2.6/site-packages/pymt/event.py", line 344, in
dispatch_event
    if func(*args):
  File "/usr/lib/python2.6/site-packages/pymt/ui/window/__init__.py", line
355, in on_draw
    w.dispatch_event('on_draw')
  File "/usr/lib/python2.6/site-packages/pymt/event.py", line 344, in
dispatch_event
    if func(*args):
  File "/usr/lib/python2.6/site-packages/pymt/ui/widgets/widget.py", line
379, in on_draw
    self.draw()
  File "/usr/lib/python2.6/site-packages/pymt/ui/widgets/kinetic.py", line
184, in draw
    self.process_kinetic()
  File "/usr/lib/python2.6/site-packages/pymt/ui/widgets/kinetic.py", line
165, in process_kinetic
    ktouch.x, ktouch.y = wid.parent.to_widget(ktouch.x, ktouch.y)
  File "/usr/lib/python2.6/site-packages/pymt/ui/widgets/widget.py", line
278, in to_widget
    x, y = self.parent.to_widget(x, y)
AttributeError: 'NoneType' object has no attribute 'to_widget'

What version of the product are you using? On what operating system?
Linux (Fedora 11) Git HEAD

Please provide any additional information below.

I "fixed" the code so it would work temporarily. A proper fix is needed.
This is the temporary fix which just check the parent object again and
returns a dummy value:

diff --git a/pymt/ui/widgets/widget.py b/pymt/ui/widgets/widget.py
index 7faec1f..a3bd0bf 100644
--- a/pymt/ui/widgets/widget.py
+++ b/pymt/ui/widgets/widget.py
@@ -275,8 +275,10 @@ class MTWidget(EventDispatcher):
 
     def to_widget(self, x, y):
         '''Return the coordinate from window to local widget'''
+        #if(self.parent != None):
         x, y = self.parent.to_widget(x, y)
         return self.to_local(x, y)
+        #return (0, 0)
 
     def to_window(self, x, y, initial=True):
         '''Transform local coordinate to window coordinate'''

Apr 7, 2010
Project Member #1 txprog
(No comment was entered for this change.)
Status: Accepted
Owner: txprog
Labels: Component-Core Milestone-0.4.1
Jun 1, 2010
Project Member #2 txprog
(No comment was entered for this change.)
Labels: Milestone-0.5
Jun 30, 2010
Project Member #3 txprog
it's already fixed
Status: Done

Powered by Google Project Hosting