Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
QtWidgets.QShortcut(QtGui.QKeySequence.SelectAll,
self.scroll_area, self.select_all)
# sort key selector
layout.addWidget(QtWidgets.QLabel(self.tr('sort by: ')), 1, 0)
self.sort_name = QtWidgets.QRadioButton(self.tr('file name'))
self.sort_name.clicked.connect(self._new_sort_order)
layout.addWidget(self.sort_name, 1, 1)
self.sort_date = QtWidgets.QRadioButton(self.tr('date taken'))
layout.addWidget(self.sort_date, 1, 2)
self.sort_date.clicked.connect(self._new_sort_order)
if eval(self.app.config_store.get('controls', 'sort_date', 'False')):
self.sort_date.setChecked(True)
else:
self.sort_name.setChecked(True)
# size selector
layout.addWidget(QtWidgets.QLabel(self.tr('thumbnail size: ')), 1, 4)
self.size_slider = QtWidgets.QSlider(Qt.Horizontal)
self.size_slider.setTracking(False)
self.size_slider.setRange(4, 9)
self.size_slider.setPageStep(1)
self.size_slider.setValue(self.thumb_size / 20)
self.size_slider.setTickPosition(QtWidgets.QSlider.TicksBelow)
width = self.size_slider.sizeHint().width()
self.size_slider.setMinimumWidth(width * 7 // 4)
self.size_slider.valueChanged.connect(self._new_thumb_size)
layout.addWidget(self.size_slider, 1, 5)
## buttons.addWidget(delete_album_button, stretch=20)
## album details, right hand side
album_form_right = QtWidgets.QFormLayout()
album_form_right.setFieldGrowthPolicy(
QtWidgets.QFormLayout.AllNonFixedFieldsGrow)
album_group.layout().addLayout(album_form_right)
# album date
self.widgets['timestamp'] = QtWidgets.QDateEdit()
self.widgets['timestamp'].setEnabled(False)
self.widgets['timestamp'].setMinimumDateTime(
QtCore.QDateTime.fromTime_t(0))
self.widgets['timestamp'].setCalendarPopup(True)
self.widgets['timestamp'].editingFinished.connect(self.new_album_details)
album_form_right.addRow(self.tr('Date'), self.widgets['timestamp'])
# album thumbnail
self.album_thumb = QtWidgets.QLabel()
self.album_thumb.setFixedWidth(160)
album_form_right.addRow(self.album_thumb)
self.layout().addWidget(album_group)
def new_set(self):
dialog = QtWidgets.QDialog(parent=self)
dialog.setWindowTitle(translate('FlickrTab', 'Create new Flickr album'))
dialog.setLayout(QtWidgets.QFormLayout())
title = SingleLineEdit(spell_check=True)
dialog.layout().addRow(translate('FlickrTab', 'Title'), title)
description = MultiLineEdit(spell_check=True)
dialog.layout().addRow(translate(
'FlickrTab', 'Description'), description)
dialog.layout().addRow(QtWidgets.QLabel(translate(
'FlickrTab', 'Album will be created when photos are uploaded')))
button_box = QtWidgets.QDialogButtonBox(
QtWidgets.QDialogButtonBox.Ok | QtWidgets.QDialogButtonBox.Cancel)
button_box.accepted.connect(dialog.accept)
button_box.rejected.connect(dialog.reject)
dialog.layout().addRow(button_box)
if dialog.exec_() != QtWidgets.QDialog.Accepted:
return
title = title.toPlainText()
if not title:
return
description = description.toPlainText()
widget = self.upload_config.add_set(title, description, None, index=0)
widget.setChecked(True)
def __init__(self, name, *arg, **kw):
super(DateAndTimeWidget, self).__init__(*arg, **kw)
self.name = name
self.setVerticalSpacing(0)
self.setColumnStretch(3, 1)
self.members = {}
# date & time
self.members['datetime'] = DateTimeEdit()
self.addWidget(self.members['datetime'], 0, 0, 1, 2)
# time zone
self.members['tz_offset'] = TimeZoneWidget()
self.addWidget(self.members['tz_offset'], 0, 2)
# precision
self.addWidget(
QtWidgets.QLabel(translate('TechnicalTab', 'Precision:')), 1, 0)
self.members['precision'] = Slider(Qt.Horizontal)
self.members['precision'].setRange(1, 7)
self.members['precision'].setPageStep(1)
self.addWidget(self.members['precision'], 1, 1)
# connections
self.members['precision'].valueChanged.connect(
self.members['datetime'].set_precision)
self.members['datetime'].editingFinished.connect(self.editing_finished)
self.members['tz_offset'].editingFinished.connect(self.editing_finished)
self.members['precision'].editing_finished.connect(self.editing_finished)
layout = QtWidgets.QGridLayout()
layout.setSpacing(0)
layout.setContentsMargins(3, 3, 3, 3)
self.setLayout(layout)
self.setToolTip(self.path)
# label to display image
self.image = QtWidgets.QLabel()
self.image.setAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
layout.addWidget(self.image, 0, 0, 1, 2)
# label to display file name
self.label = QtWidgets.QLabel()
self.label.setAlignment(Qt.AlignRight)
scale_font(self.label, 80)
layout.addWidget(self.label, 1, 1)
# label to display status
self.status = QtWidgets.QLabel()
self.status.setAlignment(Qt.AlignLeft)
set_symbol_font(self.status)
scale_font(self.status, 80)
layout.addWidget(self.status, 1, 0)
self.setFrameStyle(QtWidgets.QFrame.Panel | QtWidgets.QFrame.Plain)
self.setObjectName("thumbnail")
self.set_selected(False)
self.show_status(False)
self._set_thumb_size(self.thumb_size)
dialog.setWindowTitle(translate('FlickrTab', 'Select an image'))
dialog.setLayout(QtWidgets.QFormLayout())
dialog.layout().setFieldGrowthPolicy(
QtWidgets.QFormLayout.AllNonFixedFieldsGrow)
pixmap = QtGui.QPixmap()
pixmap.loadFromData(flickr_icon)
label = QtWidgets.QLabel()
label.setPixmap(pixmap)
dialog.layout().addRow(label, QtWidgets.QLabel(translate(
'FlickrTab', 'Which image file matches\nthis picture on Flickr?')))
divider = QtWidgets.QFrame()
divider.setFrameStyle(QtWidgets.QFrame.HLine)
dialog.layout().addRow(divider)
buttons = {}
for candidate in candidates:
label = QtWidgets.QLabel()
pixmap = candidate.image.pixmap()
if pixmap:
label.setPixmap(pixmap)
else:
label.setText(candidate.image.text())
button = QtWidgets.QPushButton(
os.path.basename(candidate.path))
button.setToolTip(candidate.path)
button.setCheckable(True)
button.clicked.connect(dialog.accept)
dialog.layout().addRow(label, button)
buttons[button] = candidate
button = QtWidgets.QPushButton(translate('FlickrTab', 'No match'))
button.setDefault(True)
button.clicked.connect(dialog.reject)
dialog.layout().addRow('', button)
def __init__(self, *arg, **kw):
super(LensSpecWidget, self).__init__(*arg, **kw)
self.setLayout(QtWidgets.QGridLayout())
self.layout().setContentsMargins(6, 0, 6, 0)
self.layout().setVerticalSpacing(0)
for text, col in ((translate('TechnicalTab', 'min'), 1),
(translate('TechnicalTab', 'max'), 2)):
label = QtWidgets.QLabel(text)
label.setAlignment(Qt.AlignHCenter)
self.layout().addWidget(label, 0, col)
self.layout().addWidget(
QtWidgets.QLabel(translate('TechnicalTab', 'Focal length')), 1, 0)
self.layout().addWidget(
QtWidgets.QLabel(translate('TechnicalTab', 'Max aperture')), 2, 0)
self.multiple = QtWidgets.QLabel(multiple_values())
self.layout().addWidget(self.multiple, 1, 1, 2, 2)
self.multiple.setAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
self.multiple.hide()
self.values = {
'min_fl' : QtWidgets.QLabel(),
'max_fl' : QtWidgets.QLabel(),
'min_fl_fn' : QtWidgets.QLabel(),
'max_fl_fn' : QtWidgets.QLabel(),
}
for key in self.values:
self.values[key].setAlignment(Qt.AlignHCenter)
self.layout().addWidget(self.values['min_fl'], 1, 1)
self.layout().addWidget(self.values['max_fl'], 1, 2)
self.layout().addWidget(self.values['min_fl_fn'], 2, 1)
self.layout().addWidget(self.values['max_fl_fn'], 2, 2)
break
else:
# new upload
return {
'set_metadata' : True,
'set_visibility': True,
'set_type' : True,
'set_albums' : True,
'replace_image' : False,
'new_photo' : True,
}, None
# get user preferences
dialog = QtWidgets.QDialog(parent=self)
dialog.setWindowTitle(translate('FlickrTab', 'Replace photo'))
dialog.setLayout(QtWidgets.QVBoxLayout())
message = QtWidgets.QLabel(translate(
'FlickrTab', 'File {0} has already been uploaded to Flickr.'
' How would you like to update it?').format(
os.path.basename(image.path)))
message.setWordWrap(True)
dialog.layout().addWidget(message)
widget = {}
widget['set_metadata'] = QtWidgets.QCheckBox(
translate('FlickrTab', 'Replace metadata'))
widget['set_visibility'] = QtWidgets.QCheckBox(
translate('FlickrTab', 'Change who can see it'))
widget['set_type'] = QtWidgets.QCheckBox(
translate('FlickrTab', 'Change content type'))
widget['set_albums'] = QtWidgets.QCheckBox(
translate('FlickrTab', 'Change album membership'))
widget['replace_image'] = QtWidgets.QCheckBox(
translate('FlickrTab', 'Replace image'))
def __init__(self, *arg, **kw):
super(LensSpecWidget, self).__init__(*arg, **kw)
self.setLayout(QtWidgets.QGridLayout())
self.layout().setContentsMargins(6, 0, 6, 0)
self.layout().setVerticalSpacing(0)
for text, col in ((translate('TechnicalTab', 'min'), 1),
(translate('TechnicalTab', 'max'), 2)):
label = QtWidgets.QLabel(text)
label.setAlignment(Qt.AlignHCenter)
self.layout().addWidget(label, 0, col)
self.layout().addWidget(
QtWidgets.QLabel(translate('TechnicalTab', 'Focal length')), 1, 0)
self.layout().addWidget(
QtWidgets.QLabel(translate('TechnicalTab', 'Max aperture')), 2, 0)
self.multiple = QtWidgets.QLabel(multiple_values())
self.layout().addWidget(self.multiple, 1, 1, 2, 2)
self.multiple.setAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
self.multiple.hide()
self.values = {
'min_fl' : QtWidgets.QLabel(),
'max_fl' : QtWidgets.QLabel(),
'min_fl_fn' : QtWidgets.QLabel(),
'max_fl_fn' : QtWidgets.QLabel(),
}