📄 wximportconfirmdialog.py
字号:
#Boa:Dialog:wxImportConfirmDialog
"""
A dialog for displaying part of the imported ASCII files for PyChem
$Id: wxImportConfirmDialog.py Copyright (C) 2005 Roger Jarvis
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
"""
from wxPython.wx import *
from wxPython.grid import *
def create(parent):
return wxImportConfirmDialog(parent)
[wxID_WXIMPORTCONFIRMDIALOG, wxID_WXIMPORTCONFIRMDIALOGBTNOK,
wxID_WXIMPORTCONFIRMDIALOGGRDSAMPLEDATA,
wxID_WXIMPORTCONFIRMDIALOGSTATICTEXT1, wxID_WXIMPORTCONFIRMDIALOGSTATICTEXT2,
wxID_WXIMPORTCONFIRMDIALOGSTATICTEXT4, wxID_WXIMPORTCONFIRMDIALOGSTCOLS,
wxID_WXIMPORTCONFIRMDIALOGSTROWS, wxID_WXIMPORTCONFIRMDIALOGSWLOADX,
] = map(lambda _init_ctrls: wxNewId(), range(9))
class wxImportConfirmDialog(wxDialog):
def _init_ctrls(self, prnt):
# generated method, don't edit
wxDialog.__init__(self, id=wxID_WXIMPORTCONFIRMDIALOG,
name='wxImportDialog', parent=prnt, pos=wxPoint(332, 188),
size=wxSize(313, 319), style=wxDEFAULT_DIALOG_STYLE,
title='Import Complete')
self.SetClientSize(wxSize(305, 285))
self.SetToolTipString('')
self.swLoadX = wxSashWindow(id=wxID_WXIMPORTCONFIRMDIALOGSWLOADX,
name='swLoadX', parent=self, pos=wxPoint(0, 0), size=wxSize(408,
352), style=wxCLIP_CHILDREN | wxSW_3D)
self.swLoadX.SetToolTipString('')
self.btnOK = wxButton(id=wxID_WXIMPORTCONFIRMDIALOGBTNOK, label='OK',
name='btnOK', parent=self.swLoadX, pos=wxPoint(104, 248),
size=wxSize(104, 26), style=0)
EVT_BUTTON(self.btnOK, wxID_WXIMPORTCONFIRMDIALOGBTNOK,
self.OnBtnOKButton)
self.grdSampleData = wxGrid(id=wxID_WXIMPORTCONFIRMDIALOGGRDSAMPLEDATA,
name='grdSampleData', parent=self.swLoadX, pos=wxPoint(16, 24),
size=wxSize(272, 208), style=wxDOUBLE_BORDER)
self.grdSampleData.SetDefaultColSize(80)
self.grdSampleData.SetDefaultRowSize(20)
self.grdSampleData.Enable(True)
self.grdSampleData.EnableEditing(False)
self.grdSampleData.SetToolTipString('')
self.grdSampleData.SetColLabelSize(20)
self.grdSampleData.SetRowLabelSize(20)
self.staticText1 = wxStaticText(id=wxID_WXIMPORTCONFIRMDIALOGSTATICTEXT1,
label='Sample Data: ', name='staticText1', parent=self.swLoadX,
pos=wxPoint(16, 8), size=wxSize(67, 13), style=0)
self.staticText1.SetToolTipString('')
self.stRows = wxStaticText(id=wxID_WXIMPORTCONFIRMDIALOGSTROWS,
label='0', name='stRows', parent=self.swLoadX, pos=wxPoint(88, 8),
size=wxSize(32, 13), style=0)
self.staticText2 = wxStaticText(id=wxID_WXIMPORTCONFIRMDIALOGSTATICTEXT2,
label='rows by ', name='staticText2', parent=self.swLoadX,
pos=wxPoint(128, 8), size=wxSize(39, 13), style=0)
self.stCols = wxStaticText(id=wxID_WXIMPORTCONFIRMDIALOGSTCOLS,
label='0', name='stCols', parent=self.swLoadX, pos=wxPoint(176,
8), size=wxSize(32, 13), style=0)
self.staticText4 = wxStaticText(id=wxID_WXIMPORTCONFIRMDIALOGSTATICTEXT4,
label='columns', name='staticText4', parent=self.swLoadX,
pos=wxPoint(216, 8), size=wxSize(39, 13), style=0)
def __init__(self, parent, data, rows, cols):
self._init_ctrls(parent)
#create grid
self.grdSampleData.CreateGrid(data.shape[0],data.shape[1])
#report rows x cols
self.stRows.SetLabel(str(rows))
self.stCols.SetLabel(str(cols))
#populate grid
for i in range(data.shape[0]):
for j in range(data.shape[1]):
self.grdSampleData.SetCellValue(i,j,str(data[i,j]))
def OnBtnOKButton(self, event):
self.Close()
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -