def __init__(self, csv_path, delimiter=',', skip_last=0): PyGridTableBase.__init__(self) # delimiter, quote could come from config file perhaps csv_reader = csv.reader(open(csv_path, 'r'), delimiter=delimiter, quotechar='"') self.grid_colnum = [] self.grid_contents = [row for row in csv_reader if len(row) > 0] company_name = self.grid_contents[0] company_street = self.grid_contents[1] company_city = self.grid_contents[2] self.report_name = self.grid_contents[3][0] # Should be Bank Register self.report_period = self.grid_contents[4] report_date = self.grid_contents[5] report_time = self.grid_contents[6] if skip_last: self.grid_contents = self.grid_contents[0:-skip_last] self.grid_rows = len(self.grid_contents) self.grid_cols = len(self.grid_contents[7]) # the 8st row is the column headers for I in range(self.grid_rows): self.grid_colnum.append(len( self.grid_contents[I])) # setup the colnum of row I # header map # results in a dictionary of column labels to numeric column location self.col_map = dict([(self.grid_contents[7][c], c) for c in range(self.grid_cols)])
def __init__(self, parent_grid, file_name): 'Inicia las carateristicas de las tablas dinámicas' PyGridTableBase.__init__(self) self.file_name = file_name self.parent_grid = parent_grid self.column_names, self.column_types, self.column_configs, self.grid_data = self.GetDataFromFile( file_name)
def __init__(self, model): """ Creates a new table base. """ # Base class constructor. PyGridTableBase.__init__(self) # The Pyface model that provides the data. self.model = model return
def __init__(self, store): """ Init GridTableBase with a Store. """ # The base class must be initialized *first* PyGridTableBase.__init__(self) self.store = store self.col_names = ["Stroke", "Translation", "Dictionary"] self._rows = self.GetNumberRows() self._cols = self.GetNumberCols()
def __init__(self, store): """ Init GridTableBase with a Store. """ # The base class must be initialized *first* PyGridTableBase.__init__(self) self.store = store cols = sorted([[COL_STROKE, "Stroke"], [COL_SPACER, ""], [COL_TRANSLATION, "Translation"], [COL_DICTIONARY, "Dictionary"]]) self.col_names = [pair[1] for pair in cols] self._rows = self.GetNumberRows() self._cols = self.GetNumberCols()
def __init__(self, store): """ Init GridTableBase with a Store. """ # The base class must be initialized *first* PyGridTableBase.__init__(self) self.store = store cols = sorted( [[COL_STROKE, "Stroke"], [COL_SPACER, ""], [COL_TRANSLATION, "Translation"], [COL_DICTIONARY, "Dictionary"]] ) self.col_names = [pair[1] for pair in cols] self._rows = self.GetNumberRows() self._cols = self.GetNumberCols()
def __init__(self, data, column_names): """data is currently a list of the form [(rowname, dictionary), dictionary.get(colname, None) returns the data for a cell """ PyGridTableBase.__init__(self) self.set_data_source(data) self.colnames = column_names # self.renderers = {"DEFAULT_RENDERER":DefaultRenderer()} # self.editors = {} # we need to store the row length and col length to see if the table has changed size self._rows = self.GetNumberRows() self._cols = self.GetNumberCols()
def __init__(self, data, column_names): """data is currently a list of the form [(rowname, dictionary), dictionary.get(colname, None) returns the data for a cell """ ##print 'Initializing virtual model' PyGridTableBase.__init__(self) self.set_data_source(data) self.colnames = column_names #self.renderers = {"DEFAULT_RENDERER":DefaultRenderer()} #self.editors = {} # we need to store the row length and col length to see if the table has changed size self._rows = self.GetNumberRows() self._cols = self.GetNumberCols()
def __init__(self,csv_path,delimiter=',',skip_last=0): PyGridTableBase.__init__(self) # delimiter, quote could come from config file perhaps csv_reader = csv.reader(open(csv_path,'r'),delimiter=delimiter,quotechar='"') self.grid_contents = [row for row in csv_reader if len(row)>0] if skip_last: self.grid_contents=self.grid_contents[:-skip_last] # the 1st row is the column headers self.grid_cols = len(self.grid_contents[0]) self.grid_rows = len(self.grid_contents) # header map # results in a dictionary of column labels to numeric column location self.col_map=dict([(self.grid_contents[0][c],c) for c in range(self.grid_cols)])
def __init__(self,csv_path,mapping,delimiter=',',skip_last=0): PyGridTableBase.__init__(self) # delimiter, quote could come from config file perhaps csv_reader = csv.reader(open(csv_path,'r'),delimiter=delimiter,quotechar='"') self.grid_contents = [row for row in csv_reader if len(row)>0] if skip_last: self.grid_contents=self.grid_contents[:-skip_last] # the 1st row is the column headers self.grid_cols = len(self.grid_contents[0]) self.grid_rows = len(self.grid_contents) # header map # results in a dictionary of column labels to numeric column location self.col_map=dict([(self.grid_contents[0][c],c) for c in range(self.grid_cols)]) self.mapping = mapping self.date_column = self.GetColPos(self.mapping['_params']['Header_TransactionDate']) self.min_datetime = None self.max_datetime = None self.TransIdPrefix = None
def __init__(self): PyGridTableBase.__init__(self)
def __init__(self, data): PyGridTableBase.__init__(self) self.data = data self.colLabels = ["File", "Line", "Type", "Message"]