Loading...
Searching...
No Matches
interrupt_gui.InterruptGui Class Reference
Inheritance diagram for interrupt_gui.InterruptGui:

Pulic Methods

def __init__ (self, parent, id, title, size)
 
def close (self, _event)
 
def cancel (self, _event)
 
def run_gams (self)
 
def run (self, _event)
 

Public Attributes

 log
 
 bu_run
 
 bu_cancel
 
 bu_close
 
 job
 

Detailed Description

Definition at line 27 of file interrupt_gui.py.

Constructors

◆ __init__()

def interrupt_gui.InterruptGui.__init__ (   self,
  parent,
  id,
  title,
  size 
)

Definition at line 28 of file interrupt_gui.py.

28 def __init__(self, parent, id, title, size):
29 wx.Frame.__init__(self, parent, id, title, size=size)
30 self.SetBackgroundColour("lightgrey")
31
32 wx.StaticText(self, -1, "GAMS Log:", (10, 10))
33 self.log = wx.TextCtrl(
34 self, pos=(10, 30), size=(565, 485), style=wx.TE_MULTILINE
35 )
36
37 self.bu_run = wx.Button(self, -1, "Run", (10, 520), (137, 33))
38 self.bu_run.Bind(wx.EVT_BUTTON, self.run)
39
40 self.bu_cancel = wx.Button(self, -1, "Cancel", (360, 520), (105, 33))
41 self.bu_cancel.Bind(wx.EVT_BUTTON, self.cancel)
42 self.bu_cancel.Disable()
43
44 self.bu_close = wx.Button(self, -1, "Close", (470, 520), (105, 33))
45 self.bu_close.Bind(wx.EVT_BUTTON, self.close)
46
47 self.job = None
48

Methods

◆ cancel()

def interrupt_gui.InterruptGui.cancel (   self,
  _event 
)

Definition at line 52 of file interrupt_gui.py.

52 def cancel(self, _event):
53 self.job.interrupt()
54

References interrupt_gui.InterruptGui.job.

◆ close()

def interrupt_gui.InterruptGui.close (   self,
  _event 
)

Definition at line 49 of file interrupt_gui.py.

49 def close(self, _event):
50 self.Close()
51

◆ run()

def interrupt_gui.InterruptGui.run (   self,
  _event 
)

Definition at line 67 of file interrupt_gui.py.

67 def run(self, _event):
68 self.log.Clear()
69 self.bu_run.Disable()
70 self.bu_close.Disable()
71 self.bu_cancel.Enable()
72 threading.Thread(target=self.run_gams).start()
73
74

References interrupt_gui.InterruptGui.bu_cancel, interrupt_gui.InterruptGui.bu_close, interrupt_gui.InterruptGui.bu_run, interrupt_gui.InterruptGui.log, and interrupt_gui.InterruptGui.run_gams().

Referenced by interrupt_gui.InterruptGui.run_gams().

◆ run_gams()

def interrupt_gui.InterruptGui.run_gams (   self)

Definition at line 55 of file interrupt_gui.py.

55 def run_gams(self):
56 writer = TextCtrlWriter(self.log)
57 ws = GamsWorkspace()
58 ws.gamslib("lop")
59 opt = ws.add_options()
60 opt.all_model_types = "soplex"
61 self.job = ws.add_job_from_file("lop.gms")
62 self.job.run(opt, output=writer)
63 self.bu_run.Enable()
64 self.bu_cancel.Disable()
65 self.bu_close.Enable()
66

References interrupt_gui.InterruptGui.bu_cancel, interrupt_gui.InterruptGui.bu_close, interrupt_gui.InterruptGui.bu_run, interrupt_gui.InterruptGui.job, interrupt_gui.InterruptGui.log, and interrupt_gui.InterruptGui.run().

Referenced by interrupt_gui.InterruptGui.run().

Member Data Documentation

◆ bu_cancel

interrupt_gui.InterruptGui.bu_cancel

◆ bu_close

interrupt_gui.InterruptGui.bu_close

◆ bu_run

interrupt_gui.InterruptGui.bu_run

◆ job

interrupt_gui.InterruptGui.job

◆ log

interrupt_gui.InterruptGui.log