Esempio n. 1
0
    def __init__(self, parent, title, data, cols=None, rows=None):
        wx.Frame.__init__(self, parent, -1, title)
        TableLogManager.add(title, self)
        self.data, self.cols, self.rows = data, cols, rows
        tableBase = GenericTable(data, cols, rows)
        self.grid = wx.grid.Grid(self)
        self.grid.SetTable(tableBase)
        self.grid.AutoSize()

        menus = [('File(&F)', [('Save as tab', self.OnSaveTab),
                               ('Save as csv', self.OnSaveCsv), ('-'),
                               ('Exit', self.OnClose)]),
                 ('Help(&H)', [('About', self.OnAbout)])]

        menuBar = wx.MenuBar()
        for menu in menus:
            m = wx.Menu()
            for item in menu[1]:
                if item[0] == '-':
                    m.AppendSeparator()
                else:
                    i = m.Append(-1, item[0])
                    if item[1] != None:
                        self.Bind(wx.EVT_MENU, item[1], i)
            menuBar.Append(m, menu[0])
        self.SetMenuBar(menuBar)
        self.Fit()
Esempio n. 2
0
    def __init__(self, parent, title, data, cols=None, rows=None):
        wx.Frame.__init__(self, parent, -1, title)
        TableLogManager.add(title, self)
        self.data, self.cols, self.rows = data, cols, rows
        tableBase = GenericTable(data, cols, rows)
        self.grid = wx.grid.Grid(self)

        ## create tablegrid and set tablegrid value
        #self.grid.SetTable(tableBase)
        self.grid.CreateGrid(len(data), len(data[0]))
        if cols != None:
            for i in range(len(cols)):
                self.grid.SetColLabelValue(i, cols[i])
        if rows != None:
            for i in range(len(rows)):
                self.grid.SetColLabelValue(i, rows[i])
        for i in range(len(data)):
            for j in range(len(data[0])):
                self.grid.SetCellValue(i, j, str(data[i][j]))
        self.grid.AutoSize()

        ## create menus
        menus = [('File(&F)', [('Save as tab', self.OnSaveTab),
                               ('Save as csv', self.OnSaveCsv), ('-'),
                               ('Exit', self.OnClose)]),
                 ('Help(&H)', [('About', self.OnAbout)])]

        ## bind the menus with the correspond events
        menuBar = wx.MenuBar()
        for menu in menus:
            m = wx.Menu()
            for item in menu[1]:
                if item[0] == '-':
                    m.AppendSeparator()
                else:
                    i = m.Append(-1, item[0])
                    if item[1] != None:
                        self.Bind(wx.EVT_MENU, item[1], i)
            menuBar.Append(m, menu[0])
        self.SetMenuBar(menuBar)
        self.Fit()
Esempio n. 3
0
 def run(self, para=None):
     table = TableLogManager.get(para['tab'])
     table.save_tab(para['path'], '\t')
Esempio n. 4
0
 def load(self):
     n = len(TableLogManager.get_titles())
     if n > 0: return True
     IPy.alert('No table opened!')
     return False
Esempio n. 5
0
 def table(cls, title, data, cols=None, rows=None):
     cls(IPy.curapp, TableLogManager.name(title), data, cols, rows).Show()
Esempio n. 6
0
 def OnClosing(self, event):
     TableLogManager.close(self.title)
     event.Skip()
Esempio n. 7
0
 def add_tab(self, title, key, unit):
     titles = TableLogManager.get_titles()
     self.add_choice(titles, str, title, key, unit)
     self.para[key] = titles[0]
     return True
Esempio n. 8
0
 def run(self, para=None):
     if para['name'] == 'All':
         for i in TableLogManager.get_titles():
             TableLogManager.close(i)
     else:
         TableLogManager.close(para['name'])
Esempio n. 9
0
 def load(self):
     TableKiller.para = {'name': 'All'}
     titles = ['All'] + TableLogManager.get_titles()
     TableKiller.view = [(list, titles, str, 'Name', 'name', 'selected')]
     return True