⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 wximportmetadatadialog.py

📁 PyChem是用Python语言编写的多元变量分析软件。它包括一个前端图形界面用于管理和保存试验数据
💻 PY
字号:
#Boa:Dialog:wxImportMetaDataDialog

"""
A dialog for import ASCII files for PyChem

$Id: wxImportMetaDataDialog.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.lib.bcrtl.user.StaticTextCtrl import *
from StaticTextCtrl import *
import string

def create(parent):
    return wxImportMetaDataDialog(parent)

[wxID_WXIMPORTDIALOG, wxID_WXIMPORTDIALOGBTNBROWSEARRAY, 
 wxID_WXIMPORTDIALOGBTNCANCEL, wxID_WXIMPORTDIALOGBTNOK, 
 wxID_WXIMPORTDIALOGSTARRAY, wxID_WXIMPORTDIALOGSWLOADX, 
] = map(lambda _init_ctrls: wxNewId(), range(6))

class wxImportDialog(wxDialog):
    def _init_ctrls(self, prnt):
        # generated method, don't edit
        wxDialog.__init__(self, id=wxID_WXIMPORTDIALOG, name='wxImportDialog',
              parent=prnt, pos=wxPoint(296, 290), size=wxSize(417, 120),
              style=wxDEFAULT_DIALOG_STYLE,
              title='Import Experiment Setup Details')
        self.SetClientSize(wxSize(409, 86))
        self.SetToolTipString('')

        self.swLoadX = wxSashWindow(id=wxID_WXIMPORTDIALOGSWLOADX,
              name='swLoadX', parent=self, pos=wxPoint(0, 0), size=wxSize(408,
              198), style=wxCLIP_CHILDREN | wxSW_3D)
        self.swLoadX.SetToolTipString('')

        self.btnBrowseArray = wxButton(id=wxID_WXIMPORTDIALOGBTNBROWSEARRAY,
              label='Browse...', name='btnBrowseArray', parent=self.swLoadX,
              pos=wxPoint(320, 16), size=wxSize(75, 23), style=0)
        EVT_BUTTON(self.btnBrowseArray, wxID_WXIMPORTDIALOGBTNBROWSEARRAY,
              self.OnBtnbrowsearrayButton)

        self.stArray = wxStaticTextCtrl(caption='',
              id=wxID_WXIMPORTDIALOGSTARRAY, name='stArray',
              parent=self.swLoadX, pos=wxPoint(16, 16), size=wxSize(296, 21),
              style=0, value='')

        self.btnOK = wxButton(id=wxID_WXIMPORTDIALOGBTNOK, label='OK',
              name='btnOK', parent=self.swLoadX, pos=wxPoint(96, 48),
              size=wxSize(104, 23), style=0)
        EVT_BUTTON(self.btnOK, wxID_WXIMPORTDIALOGBTNOK, self.OnBtnOKButton)

        self.btnCancel = wxButton(id=wxID_WXIMPORTDIALOGBTNCANCEL,
              label='Cancel', name='btnCancel', parent=self.swLoadX,
              pos=wxPoint(216, 48), size=wxSize(107, 23), style=0)
        EVT_BUTTON(self.btnCancel, wxID_WXIMPORTDIALOGBTNCANCEL,
              self.OnBtnCancelButton)

    def __init__(self, parent):
        self._init_ctrls(parent)
        
    def OnBtnbrowsearrayButton(self, event):
        self.ArrayFile = wxFileSelector('Choose Experiment Setup File',"",
        "","","CSV files (*.csv)|*.csv")
        self.stArray.SetValue(self.ArrayFile)
        return self.ArrayFile

    def OnBtnOKButton(self, event):
        self.ButtonPress = 1  
        self.Close()
                
    def OnBtnCancelButton(self, event):
        self.ButtonPress = 0
        self.Close()
    
    def GetMetaData(self):
        f = file(self.ArrayFile,'r')
        t = f.readlines()
        c = 0
        values = []
        for each in t:
            a = string.split(each,'\n')[0]
            a = string.split(a,',')
            if c == 0:
                headers = a
                c += 1
            elif c > 0:
                values.append(a)
        if c > 0:
            return headers,values
        else:
            return ()
        
    def GetButtonPress(self):
        return self.ButtonPress
    
    

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -