interrupt_gui.InterruptGui Class Reference
Inheritance diagram for interrupt_gui.InterruptGui:

Pulic Methods

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

Public Attributes

 t1
 
 log
 
 bu_run
 
 bu_cancel
 
 bu_close
 

Detailed Description

Definition at line 26 of file interrupt_gui.py.

Constructors

◆ __init__()

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

Definition at line 53 of file interrupt_gui.py.

53 def __init__(self, parent, id, title, size):
54 wx.Frame.__init__(self, parent, id, title, size=size)
55 self.SetBackgroundColour('lightgrey')
56
57 wx.StaticText(self, -1, "GAMS Log:", (10, 10))
58 self.log = wx.TextCtrl(self, pos=(10, 30), size=(565, 485), style=wx.TE_MULTILINE)
59
60 self.bu_run = wx.Button(self, -1, "Run", (10,520), (137, 33))
61 self.bu_run.Bind(wx.EVT_BUTTON, self.run)
62
63 self.bu_cancel = wx.Button(self, -1, "Cancel", (360,520), (105, 33))
64 self.bu_cancel.Bind(wx.EVT_BUTTON, self.cancel)
65 self.bu_cancel.Disable()
66
67 self.bu_close = wx.Button(self, -1, "Close", (470,520), (105, 33))
68 self.bu_close.Bind(wx.EVT_BUTTON, self.close)
69

Methods

◆ cancel()

def interrupt_gui.InterruptGui.cancel (   self,
  event 
)

Definition at line 31 of file interrupt_gui.py.

References interrupt_gui.InterruptGui.t1.

31 def cancel(self, event):
32 self.t1.interrupt()
33

◆ close()

def interrupt_gui.InterruptGui.close (   self,
  event 
)

Definition at line 28 of file interrupt_gui.py.

28 def close(self, event):
29 self.Close()
30

◆ run()

def interrupt_gui.InterruptGui.run (   self,
  event 
)

Definition at line 46 of file interrupt_gui.py.

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().

46 def run(self, event):
47 self.log.Clear()
48 self.bu_run.Disable()
49 self.bu_close.Disable()
50 self.bu_cancel.Enable()
51 threading.Thread(target=self.run_gams).start()
52

◆ run_gams()

def interrupt_gui.InterruptGui.run_gams (   self)

Definition at line 34 of file interrupt_gui.py.

References interrupt_gui.InterruptGui.log.

Referenced by interrupt_gui.InterruptGui.run().

34 def run_gams(self):
35 writer = TextCtrlWriter(self.log)
36 ws = GamsWorkspace()
37 ws.gamslib("lop")
38 opt = ws.add_options()
39 opt.all_model_types = "bdmlp"
40 self.t1 = ws.add_job_from_file("lop.gms")
41 self.t1.run(opt, output=writer)
42 self.bu_run.Enable()
43 self.bu_cancel.Disable()
44 self.bu_close.Enable()
45

Member Data Documentation

◆ bu_cancel

interrupt_gui.InterruptGui.bu_cancel

Definition at line 63 of file interrupt_gui.py.

Referenced by interrupt_gui.InterruptGui.run().

◆ bu_close

interrupt_gui.InterruptGui.bu_close

Definition at line 67 of file interrupt_gui.py.

Referenced by interrupt_gui.InterruptGui.run().

◆ bu_run

interrupt_gui.InterruptGui.bu_run

Definition at line 60 of file interrupt_gui.py.

Referenced by interrupt_gui.InterruptGui.run().

◆ log

interrupt_gui.InterruptGui.log

◆ t1

interrupt_gui.InterruptGui.t1

Definition at line 40 of file interrupt_gui.py.

Referenced by interrupt_gui.InterruptGui.cancel().