mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Possible fix for conversion box being too wide
This commit is contained in:
commit
8444a56c4c
@ -28,7 +28,11 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QComboBox" name="opt_chapter_mark"/>
|
||||
<widget class="QComboBox" name="opt_chapter_mark">
|
||||
<property name="minimumContentsLength">
|
||||
<number>30</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QCheckBox" name="opt_remove_first_image">
|
||||
|
@ -132,9 +132,11 @@ class DateEdit(QDateEdit):
|
||||
|
||||
def focusInEvent(self, x):
|
||||
self.setSpecialValueText('')
|
||||
QDateEdit.focusInEvent(self, x)
|
||||
|
||||
def focusOutEvent(self, x):
|
||||
self.setSpecialValueText(_('Undefined'))
|
||||
QDateEdit.focusOutEvent(self, x)
|
||||
|
||||
class DateTime(Base):
|
||||
|
||||
@ -142,7 +144,10 @@ class DateTime(Base):
|
||||
self.widgets = [QLabel('&'+self.col_metadata['name']+':', parent),
|
||||
DateEdit(parent)]
|
||||
w = self.widgets[1]
|
||||
w.setDisplayFormat('dd MMM yyyy')
|
||||
format = self.col_metadata['display'].get('date_format','')
|
||||
if not format:
|
||||
format = 'dd MMM yyyy'
|
||||
w.setDisplayFormat(format)
|
||||
w.setCalendarPopup(True)
|
||||
w.setMinimumDate(UNDEFINED_QDATE)
|
||||
w.setSpecialValueText(_('Undefined'))
|
||||
@ -156,7 +161,7 @@ class DateTime(Base):
|
||||
|
||||
def getter(self):
|
||||
val = self.widgets[1].date()
|
||||
if val == UNDEFINED_QDATE:
|
||||
if val <= UNDEFINED_QDATE:
|
||||
val = None
|
||||
else:
|
||||
val = qt_to_dt(val)
|
||||
|
@ -96,7 +96,7 @@ class DateDelegate(QStyledItemDelegate): # {{{
|
||||
|
||||
def displayText(self, val, locale):
|
||||
d = val.toDate()
|
||||
if d == UNDEFINED_QDATE:
|
||||
if d <= UNDEFINED_QDATE:
|
||||
return ''
|
||||
return format_date(d.toPyDate(), 'dd MMM yyyy')
|
||||
|
||||
@ -116,7 +116,7 @@ class PubDateDelegate(QStyledItemDelegate): # {{{
|
||||
|
||||
def displayText(self, val, locale):
|
||||
d = val.toDate()
|
||||
if d == UNDEFINED_QDATE:
|
||||
if d <= UNDEFINED_QDATE:
|
||||
return ''
|
||||
format = tweaks['gui_pubdate_display_format']
|
||||
if format is None:
|
||||
@ -194,7 +194,7 @@ class CcDateDelegate(QStyledItemDelegate): # {{{
|
||||
|
||||
def displayText(self, val, locale):
|
||||
d = val.toDate()
|
||||
if d == UNDEFINED_QDATE:
|
||||
if d <= UNDEFINED_QDATE:
|
||||
return ''
|
||||
return format_date(d.toPyDate(), self.format)
|
||||
|
||||
@ -217,7 +217,7 @@ class CcDateDelegate(QStyledItemDelegate): # {{{
|
||||
|
||||
def setModelData(self, editor, model, index):
|
||||
val = editor.date()
|
||||
if val == UNDEFINED_QDATE:
|
||||
if val <= UNDEFINED_QDATE:
|
||||
val = None
|
||||
model.setData(index, QVariant(val), Qt.EditRole)
|
||||
|
||||
|
@ -1216,7 +1216,9 @@ class DeviceBooksModel(BooksModel): # {{{
|
||||
return done
|
||||
|
||||
def set_editable(self, editable):
|
||||
self.editable = editable
|
||||
# Cannot edit if metadata is sent on connect. Reason: changes will
|
||||
# revert to what is in the library on next connect.
|
||||
self.editable = editable and prefs['manage_device_metadata']!='on_connect'
|
||||
|
||||
def set_search_restriction(self, s):
|
||||
pass
|
||||
|
@ -209,13 +209,13 @@ class ResultCache(SearchQueryParser):
|
||||
if query == 'false':
|
||||
for item in self._data:
|
||||
if item is None: continue
|
||||
if item[loc] is None or item[loc] == UNDEFINED_DATE:
|
||||
if item[loc] is None or item[loc] <= UNDEFINED_DATE:
|
||||
matches.add(item[0])
|
||||
return matches
|
||||
if query == 'true':
|
||||
for item in self._data:
|
||||
if item is None: continue
|
||||
if item[loc] is not None and item[loc] != UNDEFINED_DATE:
|
||||
if item[loc] is not None and item[loc] > UNDEFINED_DATE:
|
||||
matches.add(item[0])
|
||||
return matches
|
||||
|
||||
|
@ -44,7 +44,7 @@ parse_date_day_first = compute_locale_info_for_parse_date()
|
||||
utc_tz = _utc_tz = tzutc()
|
||||
local_tz = _local_tz = SafeLocalTimeZone()
|
||||
|
||||
UNDEFINED_DATE = datetime(101,1,1, tzinfo=utc_tz)
|
||||
UNDEFINED_DATE = datetime(1000,1,1, tzinfo=utc_tz)
|
||||
|
||||
def parse_date(date_string, assume_utc=False, as_utc=True, default=None):
|
||||
'''
|
||||
|
Loading…
x
Reference in New Issue
Block a user