def onAdd(self, event): wildcard = "Processes (*.json)|*.json" dialog = wx.FileDialog(self, "Open Process", wildcard=wildcard, style=wx.FD_OPEN | wx.FD_FILE_MUST_EXIST, defaultDir="./processes") if dialog.ShowModal() == wx.ID_CANCEL: return path = dialog.GetPath() x = wx.GetNumberFromUser( "OS Simulator", "How many of this process would you like to open?", "User Entry", 5, max=1000, parent=self) if x < 1: return if os.path.exists(path): sim_mailbox.put(c.Cmd_CreateProcess(path, x)) else: msg = wx.MessageDialog(self, "File does not exist!", style=wx.OK) msg.ShowModal()
def GUI_MainThread(): app = wx.App() ex = frame(None, title='Sizing') ex.Show() Thread(target=GUI_UpdateThread, args=(ex, )).start() app.MainLoop() gui_mailbox.put("close") sim_mailbox.put("close")
def onQuant(self, event): x = wx.GetNumberFromUser("OS Simulator", "What would you like the quantum to be?", "User Entry", 10, max=1000, parent=self) if x < 0: return sim_mailbox.put(c.Cmd_Quantum(x))
def onSpeed(self, event): x = wx.GetNumberFromUser( "OS Simulator", "Enter a new refresh rate in hundredths of a second: ", "User Entry", 5, max=1000, parent=self) if x < 1: return sim_mailbox.put(c.Cmd_ChangeSpeed(x))
def onRand(self, event): x = wx.GetNumberFromUser( "OS Simulator", "How many of this process would you like to open?", "User Entry", 5, max=1000, parent=self) if x < 0: return sim_mailbox.put(c.Cmd_RandProcess(x))
def onSwitch(self, event): sim_mailbox.put("switch")
def onStop(self, event): sim_mailbox.put("stop")
def onRun(self, event): sim_mailbox.put("run")