#!/boot/home/config/bin/python import os import struct import sys import BApplication from BBox import BBox from BWindow import BWindow from BMessage import BMessage from BTextControl import BTextControl from InterfaceKit import B_FOLLOW_ALL,B_PLAIN_BORDER,B_TITLED_WINDOW,B_WILL_DRAW,B_NOT_MINIMIZABLE,B_NOT_RESIZABLE from AppKit import B_QUIT_REQUESTED class QWindow(BWindow): def __init__(self, frame): BWindow.__init__(self, frame, "Run Program...", B_TITLED_WINDOW, B_NOT_MINIMIZABLE|B_NOT_RESIZABLE) # set up a rectangle and instantiate a new view r, t, l, b = self.Bounds() self.top = BBox((r, t, l, b), 'top', B_FOLLOW_ALL, B_WILL_DRAW, B_PLAIN_BORDER) msg = BMessage(9) self.xc = BTextControl((r + 20, t + 8, l - 20, b - 8), 'xc', 'Run Program...', '', msg) self.top.AddChild(self.xc) self.AddChild(self.top); self.xc.MakeFocus(True) def MessageReceived(self, msg): if msg.what == 9: os.spawnlp(os.P_NOWAIT, self.xc.Text(), self.xc.Text()) self.QuitRequested() BWindow.MessageReceived(self, msg) def QuitRequested(self): BApplication.be_app.PostMessage(B_QUIT_REQUESTED) return 1 class RunApplication(BApplication.BApplication): def __init__(self): BApplication.BApplication.__init__(self, "application/x-vnd.Run") def ReadyToRun(self): window = QWindow((100.0, 80.0, 340.0, 115.0)) window.Show() myApplication = RunApplication() myApplication.Run()