code
stringlengths
3
6.57k
Copyright (c)
Run (ctrl+R)
logging.getLogger(__name__)
frame.getAuiManager()
ErrorDialog(wx.Dialog)
__init__(self, parent, msg=None)
wx.Dialog.__init__(self, parent, title="An Error Occurred")
self.SetSize((600, 275)
wx.BoxSizer(wx.VERTICAL)
wx.TextCtrl(self, wx.ID_ANY, size=(500,150)
error_msg_box.AppendText(msg)
vbox.Add(error_msg_box, 0, wx.TOP|wx.EXPAND, 20)
self.CreateSeparatedButtonSizer(wx.OK)
vbox.Add(btns, 0, wx.CENTER|wx.ALL, 10)
wx.BoxSizer(wx.HORIZONTAL)
wx.ArtProvider.GetBitmap(wx.ART_ERROR, wx.ART_TOOLBAR, (50, 50)
wx.StaticBitmap(self, -1, save_ico, wx.DefaultPosition, (save_ico.GetWidth()
save_ico.GetHeight()
hbox.Add(img_info, 0, wx.ALL, 20)
hbox.Add(vbox, 0, wx.ALL, 0)
self.SetSizer(hbox)
self.Centre()
self.CenterOnParent()
ProgressDialog(wx.Dialog)
__init__(self, parent)
wx.Dialog.__init__(self, parent, title="SCT Processing")
self.SetSize((300, 120)
wx.BoxSizer(wx.VERTICAL)
wx.StaticText(self, id=wx.ID_ANY, label="Processing, please wait...")
vbox.Add(lbldesc, 0, wx.ALIGN_CENTER|wx.ALL, 10)
wx.Button(self, wx.ID_CANCEL, 'Stop')
vbox.Add(stop_button, 0, wx.CENTER|wx.ALL, 10)
wx.BoxSizer(wx.HORIZONTAL)
gears (similar to ID_EXECUTE)
wx.ArtProvider.GetBitmap(wx.ART_INFORMATION, wx.ART_TOOLBAR, (50, 50)
wx.StaticBitmap(self, -1, save_ico, wx.DefaultPosition, (save_ico.GetWidth()
save_ico.GetHeight()
hbox.Add(img_info, 0, wx.ALL, 10)
hbox.Add(vbox, 0, wx.ALL, 0)
self.SetSizer(hbox)
self.Centre()
self.CenterOnParent()
stop_button.Bind(wx.EVT_BUTTON, self.OnStop)
OnStop(self, event)
print(f"Stop was pressed. event={event}")
self.Destroy()
SCTCallThread(Thread)
__init__(self, command, text_window_ctrl)
Thread.__init__(self)
sct_call(self, command)
os.environ.copy()
subprocess.Popen(self.command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True, env=env)
proc.stdout.fileno()
proc.stderr.fileno()
os.set_blocking(stdout_fd, False)
os.set_blocking(stderr_fd, False)
proc.poll()
select.select(rs, ws, xs, timeout)
os.read(stdout_fd, 1024)
msg.decode('utf-8')
os.read(stderr_fd, 1024)
msg.decode('utf-8')
wx.CallAfter(self.text_window.WriteText, msg)
sct_interrupt(self)
self.p.send_signal(signal.SIGINT)
print("No process running?")
run(self)
Thread.run()
self.sct_call(self.command)
button (left)
box (right)
TextBox.textctrl.GetValue()
__init__(self, sctpanel, label="")
wx.TextCtrl(sctpanel)
wx.BoxSizer(wx.HORIZONTAL)
wx.Button(sctpanel, -1, label=label)
button_fetch_file.Bind(wx.EVT_BUTTON, self.get_highlighted_file_name)
self.hbox.Add(button_fetch_file, 0, wx.ALIGN_LEFT| wx.RIGHT, 10)
self.hbox.Add(self.textctrl, 1, wx.ALIGN_LEFT|wx.LEFT, 10)
get_highlighted_file_name(self, event)
displayCtx.getSelectedOverlay()
print("Fetched file name: {}".format(filename_path)
self.textctrl.SetValue(filename_path)
get_file_name(self)
self.textctrl.GetValue()
SCTPanel(wx.Panel)
citation (please always cite)
__init__(self, parent, id_)
super(SCTPanel, self)
__init__(parent=parent, id=id_)
wx.BoxSizer(wx.HORIZONTAL)
wx.BoxSizer(wx.VERTICAL)
wx.BoxSizer(wx.VERTICAL)
wx.BoxSizer(wx.VERTICAL)
self.get_logo()
wx.BoxSizer(wx.HORIZONTAL)
logo_help_hbox.Add(sct_logo, 1, wx.HORIZONTAL, 5)
wx.Button(self, id=id_, label="Help")
button_help.Bind(wx.EVT_BUTTON, self.help_url)
logo_help_hbox.Add(button_help, 0, wx.ALIGN_BOTTOM|wx.LEFT, 90)