IGN:Fix localization of timestamp for device files

This commit is contained in:
Kovid Goyal 2008-07-16 13:10:03 -07:00
parent c4eb7fea8b
commit 28a93ca9c7
4 changed files with 13 additions and 8 deletions

View File

@ -30,7 +30,12 @@ islinux = not(iswindows or isosx)
try:
locale.setlocale(locale.LC_ALL, '')
except:
pass
dl = locale.getdefaultlocale()
try:
if dl:
locale.setlocale(dl[0])
except:
pass
try:
preferred_encoding = locale.getpreferredencoding()

View File

@ -574,7 +574,7 @@ class DeviceBooksModel(BooksModel):
for row in rows:
if not succeeded:
indices = self.row_indices(self.index(row, 0))
self.emit(SIGNAL('dataChanged(QModelIndex, QModelIndex)'), indices[0], indices[-1])
self.emit(SIGNAL('dataChanged(QModelIndex, QModelIndex)'), indices[0], indices[-1])
def paths_deleted(self, paths):
self.map = list(range(0, len(self.db)))
@ -691,7 +691,7 @@ class DeviceBooksModel(BooksModel):
dt = item.datetime
dt = datetime(*dt[0:6])
dt = dt - timedelta(seconds=time.timezone) + timedelta(hours=time.daylight)
data[_('Timestamp')] = dt.ctime()
data[_('Timestamp')] = dt.strftime('%a %b %d %H:%M:%S %Y')
data[_('Tags')] = ', '.join(item.tags)
self.emit(SIGNAL('new_bookdisplay_data(PyQt_PyObject)'), data)

View File

@ -254,7 +254,7 @@ def download_tarball():
if pb is not None:
pb.update(percent)
else:
print '%d%%, '%int(percent*100)
print '%d%%, '%int(percent*100),
f.seek(0)
return f

View File

@ -33,7 +33,7 @@ except:
preferred_encoding = 'utf-8'
iswindows = 'win32' in sys.platform or 'win64' in sys.platform
isosx = 'darwin' in sys.platform
isosx = 'darwin' in sys.platform
def load_library():
if isosx:
@ -94,7 +94,7 @@ class FcValue(Structure):
_fields_ = [
('type', c_int),
('u', _FcValue)
]
]
lib = load_library()
lib.FcPatternCreate.restype = c_void_p
@ -145,12 +145,12 @@ if hasattr(sys, 'frameworks_dir'):
elif not lib.FcInit():
raise RuntimeError(_('Could not initialize the fontconfig library'))
def find_font_families(allowed_extensions=['ttf']):
def find_font_families(allowed_extensions=['ttf', 'otf']):
'''
Return an alphabetically sorted list of font families available on the system.
`allowed_extensions`: A list of allowed extensions for font file types. Defaults to
`['ttf']`. If it is empty, it is ignored.
`['ttf', 'otf']`. If it is empty, it is ignored.
'''
allowed_extensions = [i.lower() for i in allowed_extensions]