def create_window(self): EM = self.xcore.EventMask CW = self.xcore.CW self.window = DisplayWindow( self.xcore.create_toplevel( self.bounds, klass=self.xcore.WindowClass.InputOutput, params={ CW.EventMask: EM.Exposure | EM.SubstructureNotify, CW.OverrideRedirect: True, }), self.expose) self.window.want.size = self.bounds di(self).inject(self.window) self.dispatcher.register_window(self.window) self.window.show()
def __zorro_di_done__(self): wid = self.xcore.create_toplevel( Rectangle(0, 0, 1, 1), klass=self.xcore.WindowClass.InputOutput, params={ self.xcore.CW.BackPixel: self.theme.menu.background, self.xcore.CW.OverrideRedirect: True, self.xcore.CW.EventMask: self.xcore.EventMask.Exposure, }) self.window = di(self).inject(DisplayWindow(wid, self.paint)) self.dispatcher.all_windows[wid] = self.window self.window.show() if self.screen.group: self._group_hook() self.commander.events['window'].listen(self._check_redraw) Window.any_window_changed.listen(self._check_redraw)
def cmd_show(self): if self.window: self.cmd_hide() self._current_items = self.items() show_lines = min(len(self._current_items) + 1, self.max_lines) h = self.theme.menu.line_height self.height = h * self.max_lines bounds = self.commander['screen'].bounds._replace(height=h) self._img = self.xcore.pixbuf(bounds.width, h) wid = self.xcore.create_toplevel( bounds, klass=self.xcore.WindowClass.InputOutput, params={ self.xcore.CW.BackPixel: self.theme.menu.background, self.xcore.CW.OverrideRedirect: True, self.xcore.CW.EventMask: self.xcore.EventMask.FocusChange | self.xcore.EventMask.EnterWindow | self.xcore.EventMask.LeaveWindow | self.xcore.EventMask.KeymapState | self.xcore.EventMask.KeyPress, }) self.window = di(self).inject( DisplayWindow(wid, self.draw, focus_out=self._close)) self.dispatcher.all_windows[wid] = self.window self.dispatcher.frames[wid] = self.window # dirty hack self.window.show() self.window.focus() self.text_field = di(self).inject( TextField(self.theme.menu, events={ 'draw': self.redraw, 'submit': self.submit_ev, 'complete': self.complete, 'close': self.close, })) self.dispatcher.active_field = self.text_field self._redraw()