Ejemplo n.º 1
0
    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()
Ejemplo n.º 2
0
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")
Ejemplo n.º 3
0
    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))
Ejemplo n.º 4
0
 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))
Ejemplo n.º 5
0
    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))
Ejemplo n.º 6
0
 def onSwitch(self, event):
     sim_mailbox.put("switch")
Ejemplo n.º 7
0
 def onStop(self, event):
     sim_mailbox.put("stop")
Ejemplo n.º 8
0
 def onRun(self, event):
     sim_mailbox.put("run")