Commits

Henning Schröder  committed e0ed5be

TObject.configure(**kwargs)

  • Participants
  • Parent commits 6cbf198

Comments (0)

Files changed (4)

File tcore/__init__.py

 
         if parent:
             self.setParent(parent)
+        self.configure(**kwargs)
 
-        for key, value in kwargs.items():
+    def configure(self, **kwargs):
+        for (key, value) in kwargs.iteritems():
             obj = getattr(self.__class__, key)
             if isinstance(obj, Property):
                 obj.setter(self, value)

File tgui/tapplication.py

 
     def paintEvent(self, event):
         painter = TPainter(self)
-        pos = self.pos()
+        pos = self.mapToGlobal(self.pos())
         size = self.size()
         painter.engine.draw_desktop(pos.x, pos.y, size.width, size.height)

File tgui/twidget.py

             else:
                 self.focusOutEvent(event)
 
+    def hideEvent(self, event):
+        pass
+
     def showEvent(self, event):
         if not self.parent():
             tApp().setActiveWindow(self)

File tgui/widgets.py

         self._text = text
 
     def sizeHint(self):
-        return TSize(min(70, len(self._text)), 1)
+        return TSize(min(70, len(self._text)) + 4, 1)
 
     def setText(self, text):
         self._text = text
         TWidget.paintEvent(event)
         painter = TPainter(self)
         rect = self.geometry()
+        # TODO: engine.draw_frame
         painter.drawRect(rect)
         for child in self.children():
             child.paintEvent(event)
 
     def addMenu(self, menu):
         self._menus.append(menu)
+        menu.hide()
 
     def keyPressEvent(self, event):
         if event.key == TKey.Key_Right: