コード例 #1
0
    def OnInit(self):
        frame = wxFrame(NULL, -1, "EPlusInterface V0.002")
        frame.Show(true)
        self.SetTopWindow(frame)
        
        dlg = wx.FileDialog(
            frame, message="Choose a file", defaultDir=os.getcwd(), 
            defaultFile="", wildcard=wildcardopen, style=wx.OPEN | wx.MULTIPLE | wx.CHANGE_DIR
            )
        if dlg.ShowModal() == wx.ID_OK:
            # This returns a Python list of files that were selected.
            paths = dlg.GetPaths()
            fname = paths[0]
            txt = open(fname, 'r').read()
            eplustxt = makeidf.makeidf(txt) 
        dlg.Destroy()
        
        dlg = wx.FileDialog(
            frame, message="Save file as ...", defaultDir=os.getcwd(), 
            defaultFile="", wildcard=wildcardsave, style=wx.SAVE
            )
        if dlg.ShowModal() == wx.ID_OK:
            # This returns a Python list of files that were selected.
            paths = dlg.GetPaths()
            fname = paths[0]
            open(fname, 'wb').write(eplustxt)
        dlg.Destroy()
        frame.Close()

        return true
コード例 #2
0
def main():
    """
    reads e.txt as the sketchup output file
    save the it as e.idf
    """
    fname = 'e.txt'
    txt = open(fname, 'r').read()
    eplustxt = makeidf.makeidf(txt) 
    open('e.idf', 'wb').write(eplustxt)
コード例 #3
0

"""
This the Pythoncard interface.
Not using it now since py2exe is chocking on pythoncard
"""

from PythonCard import model
from PythonCard import dialog
import makeidf


class Minimal(model.Background):
    pass 
    
if __name__ == '__main__':
    app = model.Application(Minimal)
    wildcard = '*.txt'
    result = dialog.openFileDialog(wildcard=wildcard, style=dialog.wx.OPEN)
    if result.accepted:
        fname = result.paths[0]
        txt = open(fname, 'r').read()
        eplustxt = makeidf.makeidf(txt) 
    open('ee.idf', 'wb').write(eplustxt)
    wildcard = '*.idf'
    result = dialog.saveFileDialog(wildcard=wildcard)
    if result.accepted:
        fname = result.paths[0]
        open(fname, 'wb').write(eplustxt)
    app.Exit()