Пример #1
0
 def GetSelectedRows(self):
     srows = []
     top_left = self.GetSelectionBlockTopLeft()
     bottom_right = self.GetSelectionBlockBottomRight()
     if not isempty(bottom_right) and not isempty(top_left):
         max_row = bottom_right[0][0]
         min_row = top_left[0][0]
         srows = range(min_row, max_row + 1)
     return srows
Пример #2
0
 def GetSelectedCols(self):
     scols = []
     top_left = self.GetSelectionBlockTopLeft()
     bottom_right = self.GetSelectionBlockBottomRight()
     if not isempty(bottom_right) and not isempty(top_left):
         max_col = bottom_right[0][1]
         min_col = top_left[0][1]
         scols = range(min_col,max_col+1)
     return scols
Пример #3
0
 def GetSelectedCols(self):
     scols = []
     top_left = self.GetSelectionBlockTopLeft()
     bottom_right = self.GetSelectionBlockBottomRight()
     if not isempty(bottom_right) and not isempty(top_left):
         max_col = bottom_right[0][1]
         min_col = top_left[0][1]
         scols = range(min_col,max_col+1)
     return scols
Пример #4
0
 def GetSelectedRows(self):
     srows = []
     top_left = self.GetSelectionBlockTopLeft()
     bottom_right = self.GetSelectionBlockBottomRight()
     if not isempty(bottom_right) and not isempty(top_left):
         max_row = bottom_right[0][0]
         min_row = top_left[0][0]
         srows = range(min_row,max_row+1)
     return srows
Пример #5
0
 def __setitem__(self, key, value):
     if isinstance(key, (int, long)):
         self.__tags[key] = value
         return
     elif key.startswith('__'):
         if key == '__image':
             self.images = value
         if key in FILETAGS:
             setattr(self, fn_hash[key], value)
         elif key == '__total':
             self.__tags['totaltracks'] = FUNCS['totaltracks'][1](value)
         return
     elif isempty(value):
         if key in self:
             del (self[key])
         return
     else:
         try:
             new_val = FUNCS[key][1](value)
             if value:
                 self.__tags[key] = new_val
         except KeyError:
             #User defined tags.
             self.__freeform[key] = '----:com.apple.iTunes:%s' % key
             self.__tags[key] = settext(value)
         except ValueError:
             pass
Пример #6
0
 def del_cols(self,event):
     """
     Delete columns
     """
     cols = self.GetSelectedCols()
     if not isempty(cols):
         self.DeleteCols(cols[0],len(cols))
Пример #7
0
 def del_rows(self,event):
     """
     Delete rows
     """
     rows = self.GetSelectedRows()
     if not isempty(rows):
         self.DeleteRows(rows[0],len(rows))
Пример #8
0
 def del_cols(self,event):
     """
     Delete columns
     """
     cols = self.GetSelectedCols()
     if not isempty(cols):
         self.DeleteCols(cols[0],len(cols))
Пример #9
0
 def del_rows(self,event):
     """
     Delete rows
     """
     rows = self.GetSelectedRows()
     if not isempty(rows):
         self.DeleteRows(rows[0],len(rows))
Пример #10
0
 def __setitem__(self, key, value):
     if isinstance(key, (int, long)):
         self.__tags[key] = value
         return
     elif key.startswith('__'):
         if key == '__image':
             self.images = value
         if key in FILETAGS:
             setattr(self, fn_hash[key], value)
         elif key == '__total':
             self.__tags['totaltracks'] = FUNCS['totaltracks'][1](value)
         return
     elif isempty(value):
         if key in self:
             del(self[key])
         return
     else:
         try:
             new_val = FUNCS[key][1](value)
             if value:
                 self.__tags[key] = new_val
         except KeyError:
             #User defined tags.
             self.__freeform[key] = '----:com.apple.iTunes:%s' % key
             self.__tags[key] = settext(value)
         except ValueError:
             pass
Пример #11
0
def convert(book, sheetname):
    sheet = book.sheet_by_name(sheetname)

    print "{| class=\"wikitable\""
    for row in sheet.get_rows():
        if isempty(row):
            continue
        print "| " + " || ".join([content(book, cell) for cell in row])
        print "|-"
    print "|}"
Пример #12
0
def convert(book, sheetname):
    sheet = book.sheet_by_name(sheetname)
    level = 0

    print "{| class=\"wikitable\""
    for row in sheet.get_rows():
        if isempty(row):
            continue
        level = __print_row(book, row, level)
        print "|-"
    print "|}"
Пример #13
0
        def __setitem__(self, key, value):

            if key == '__image':
                self.images = value
                return

            if key.startswith('__'):
                if key == '__image':
                    self.images = value
                elif key == '__total':
                    set_total(self, value)
                elif key in fn_hash:
                    setattr(self, fn_hash[key], value)
                return
            elif isempty(value):
                if key in self:
                    del (self[key])
            else:
                value = unicode_list(value)
                if isempty(value): return
                self.__tags[key] = value
Пример #14
0
        def __setitem__(self, key, value):
            
            if key == '__image':
                self.images = value
                return

            if key.startswith('__'):
                if key == '__image':
                    self.images = value
                elif key == '__total':
                    set_total(self, value)
                elif key in fn_hash:
                    setattr(self, fn_hash[key], value)
                return
            elif isempty(value):
                if key in self:
                    del(self[key])
            else:
                value = unicode_list(value)
                if isempty(value): return
                self.__tags[key] = value
Пример #15
0
def bindstar(stream, *goals):
    """ Bind many goals to a stream

    See Also:
        bind
    """
    for goal in goals:
        # Short circuit in case of empty stream
        a, stream = it.tee(stream, 2)
        if isempty(a):
            return stream
        # Bind stream to new goal
        stream = bind(stream, goal)
    return stream
Пример #16
0
 def GetArrayData(self):
     nrows = self.GetNumberRows()
     ncols = self.GetNumberCols()
     X = []
     for i in range(nrows):
         row = []
         for j in range(ncols):
             cval = self.GetCellValue(i, j)
             if not isempty(cval):
                 row.append(cval)
             else:
                 row.append("")
         X.append(row)
     return X
Пример #17
0
 def GetArrayData(self):
     nrows = self.GetNumberRows()
     ncols = self.GetNumberCols()
     X = []
     for i in range(nrows):
         row = []
         for j in range(ncols):
             cval = self.GetCellValue(i,j)
             if not isempty(cval):
                 row.append(cval)
             else:
                 row.append("")
         X.append(row)
     return X
Пример #18
0
    def __setitem__(self,key,value):
        if key.startswith('__'):

            if key == '__image':
                self.images = value
            elif key in fn_hash:
                setattr(self, fn_hash[key], value)
            elif key == '__total' and 'track' in self:
                if set_total(self, value):
                    return
            return
        elif isempty(value):
            del(self[key])
        elif key in self.__rtranslate:
            self.__tags[key] = unicode_list(value)
Пример #19
0
 def GetArrayData(self):
     nrows = self.GetNumberRows()
     ncols = self.GetNumberCols()
     X = np.zeros((nrows,ncols))
     for i in range(nrows):
         for j in range(ncols):
             cval = self.GetCellValue(i,j)
             if not isempty(cval):
                 try:
                     X[i][j] = float(cval)
                 except:
                     # Revisar valores devueltos
                     X[i][j] = np.nan
             else:
                 X[i][j] = np.nan
     return X
Пример #20
0
 def GetArrayData(self):
     nrows = self.GetNumberRows()
     ncols = self.GetNumberCols()
     X = np.zeros((nrows,ncols))
     for i in range(nrows):
         for j in range(ncols):
             cval = self.GetCellValue(i,j)
             if not isempty(cval):
                 try:
                     X[i][j] = float(cval)
                 except:
                     # Revisar valores devueltos
                     X[i][j] = np.nan
             else:
                 X[i][j] = np.nan
     return X
Пример #21
0
 def __setitem__(self, key, value):
     if key.startswith('__'):
         if key == '__image':
             self.images = value
         elif key == '__total':
             set_total(self, value)
         elif key in fn_hash:
             setattr(self, fn_hash[key], value)
     elif isempty(value):
         if key in self:
             del(self[key])
         else:
             return
     else:
         if isinstance(value, (int, long)):
             self.__tags[key.lower()] = [unicode(value)]
         else:
             self.__tags[key.lower()] = unicode_list(value)
Пример #22
0
        def __setitem__(self, key, value):
            if not isinstance(key, basestring):
                self.__tags[key] = value
                return
            if key.startswith('__'):
                if key == '__image':
                    self.images = value
                elif key in fn_hash:
                    setattr(self, fn_hash[key], value)
                elif key == '__total':
                    set_total(self, value)
                return

            value = unicode_list(value)

            if isempty(value):
                if key in self:
                    del (self[key])
                return

            if key in self.__tags:
                self.__tags[key].set_value(value)
            else:
                if key in write_frames:
                    self.__tags.update(write_frames[key](value))
                elif key == u'comment':
                    frame = {'comment': create_comment('', value)['comment:']}
                    self.__tags.update(frame)
                elif key.startswith('comment:'):
                    self.__tags.update(
                        create_comment(key[len('comment:'):], value))
                elif key.startswith('www:'):
                    self.__tags.update(create_userurl(key, value))
                elif key.startswith('ufid:'):
                    self.__tags.update(create_ufid(key, value))
                elif key.startswith('rgain:'):
                    self.__tags.update(create_rgain(key, value))
                elif key.startswith('unsyncedlyrics:'):
                    self.__tags.update(create_uslt(key, value))
                else:
                    self.__tags.update(create_usertext(key, value))
Пример #23
0
        def __setitem__(self, key, value):
            if not isinstance(key, basestring):
                self.__tags[key] = value
                return
            if key.startswith('__'):
                if key == '__image':
                    self.images = value
                elif key in fn_hash:
                    setattr(self, fn_hash[key], value)
                elif key == '__total':
                    set_total(self, value)
                return

            value = unicode_list(value)

            if isempty(value):
                if key in self:
                    del(self[key])
                return

            if key in self.__tags:
                self.__tags[key].set_value(value)
            else:
                if key in write_frames:
                    self.__tags.update(write_frames[key](value))
                elif key == u'comment':
                    frame = {'comment': create_comment('', value)['comment:']}
                    self.__tags.update(frame)
                elif key.startswith('comment:'):
                    self.__tags.update(create_comment(key[len('comment:'):], value))
                elif key.startswith('www:'):
                    self.__tags.update(create_userurl(key, value))
                elif key.startswith('ufid:'):
                    self.__tags.update(create_ufid(key, value))
                elif key.startswith('rgain:'):
                    self.__tags.update(create_rgain(key, value))
                elif key.startswith('unsyncedlyrics:'):
                    self.__tags.update(create_uslt(key, value))
                else:
                    self.__tags.update(create_usertext(key, value))