[PATCH][meh] propagate screen when using text mode

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Was playing with python-meh today and noticed that it doesn't propagate the screen from TextIntf to it's methods which leads to:

NoneType has no attribute height

Attached reproducer and patch which fixes it.

Regards,
Jirka
#!/usr/bin/env python
from snack import *

from meh.dump import ReverseExceptionDump
from meh.handler import *
from meh.ui.text import *

class Config:
      def __init__(self):
          self.programName = "abrt"
          self.programVersion = "2.0"
          self.attrSkipList = []
          self.fileList = []
          self.config_value_one = 1
          self.config_value_two = 2

s = SnackScreen()
config = Config()
intf = TextIntf(screen=s)
handler = ExceptionHandler(config, intf, ReverseExceptionDump)
handler.install(None)

l = Button('divide by zero!')
gf = GridForm(s, 'test', 1, 1)
gf.add(l, 0, 0)
result = gf.run()
if result == l:
   1/0

s.popWindow()
s.finish()
--- python-meh-0.11/meh/ui/text.py	2011-01-25 17:11:42.000000000 +0100
+++ python-meh-0.11_/meh/ui/text.py	2011-08-11 15:20:37.968003533 +0200
@@ -27,23 +27,24 @@
 class TextIntf(AbstractIntf):
     def __init__(self, *args, **kwargs):
         AbstractIntf.__init__(self, *args, **kwargs)
+        self.screen = kwargs.get("screen", None)
 
     def exitWindow(self, title, message, *args, **kwargs):
-        win = ExitWindow(title, message, *args, **kwargs)
+        win = ExitWindow(title, message, *args, screen = self.screen)
         win.run()
         win.destroy()
 
     def mainExceptionWindow(self, text, exnFile, *args, **kwargs):
-        win = MainExceptionWindow(text, exnFile, *args, **kwargs)
+        win = MainExceptionWindow(text, exnFile, *args, screen = self.screen)
         return win
 
     def messageWindow(self, title, message, *args, **kwargs):
-        win = MessageWindow(title, message, *args, **kwargs)
+        win = MessageWindow(title, message, *args, screen = self.screen)
         win.run()
         win.destroy()
 
     def saveExceptionWindow(self, accountManager, signature, *args, **kwargs):
-        win = SaveExceptionWindow(accountManager, signature)
+        win = SaveExceptionWindow(accountManager, signature, screen = self.screen)
         win.run()
 
 class SaveExceptionWindow(AbstractSaveExceptionWindow):
_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list

[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux