Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
left_side = QtWidgets.QGridLayout()
# latitude & longitude
self.coords = LatLongDisplay(self.image_list)
left_side.addWidget(self.coords.label, 0, 0)
self.coords.changed.connect(self.new_coords)
left_side.addWidget(self.coords, 0, 1)
# altitude
label = QtWidgets.QLabel(translate('MapTabsAll', 'Altitude'))
label.setAlignment(Qt.AlignRight)
left_side.addWidget(label, 1, 0)
self.altitude = DoubleSpinBox()
self.altitude.setSuffix(' m')
self.altitude.new_value.connect(self.new_altitude)
left_side.addWidget(self.altitude, 1, 1)
if hasattr(self.geocoder, 'get_altitude'):
self.altitude_button = QtWidgets.QPushButton(
translate('MapTabsAll', 'Get altitude from map'))
self.altitude_button.clicked.connect(self.get_altitude)
left_side.addWidget(self.altitude_button, 2, 1)
else:
self.altitude_button = None
# search
label = QtWidgets.QLabel(translate('MapTabsAll', 'Search'))
label.setAlignment(Qt.AlignRight)
left_side.addWidget(label, 3, 0)
self.edit_box = ComboBox()
self.edit_box.setEditable(True)
self.edit_box.setInsertPolicy(QtWidgets.QComboBox.NoInsert)
self.edit_box.lineEdit().setPlaceholderText(
translate('MapTabsAll', ''))
self.edit_box.lineEdit().returnPressed.connect(self.search)
self.edit_box.activated.connect(self.goto_search_result)
def __init__(self, *arg, **kw):
super(LineEditWithAuto, self).__init__(*arg, **kw)
self._is_multiple = False
layout = QtWidgets.QHBoxLayout()
layout.setContentsMargins(0, 0, 0, 0)
self.setLayout(layout)
# line edit box
self.edit = LineEdit()
layout.addWidget(self.edit)
# auto complete button
self.auto = QtWidgets.QPushButton(translate('DescriptiveTab', 'Auto'))
layout.addWidget(self.auto)
# adopt child widget methods and signals
self.set_value = self.edit.set_value
self.get_value = self.edit.get_value
self.set_multiple = self.edit.set_multiple
self.is_multiple = self.edit.is_multiple
self.editingFinished = self.edit.editingFinished
self.autoComplete = self.auto.clicked
album_form_left.addRow(self.tr('Description'), self.widgets['album_description'])
# album location
self.widgets['album_location'] = QtWidgets.QLineEdit()
self.widgets['album_location'].setReadOnly(True)
album_form_left.addRow(self.tr('Location'), self.widgets['album_location'])
# right hand side
album_form_right = QtWidgets.QVBoxLayout()
album_group.layout().addLayout(album_form_right)
# album thumbnail
self.widgets['album_thumb'] = QtWidgets.QLabel()
self.widgets['album_thumb'].setFixedSize(150, 150)
self.widgets['album_thumb'].setAlignment(Qt.AlignHCenter | Qt.AlignTop)
album_form_right.addWidget(self.widgets['album_thumb'])
album_form_right.addStretch(1)
# new album
new_album_button = QtWidgets.QPushButton(self.tr('New album'))
new_album_button.clicked.connect(self.new_album)
album_form_right.addWidget(new_album_button)
self.layout().addWidget(album_group, stretch=1)
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)
if dialog.exec_() == QtWidgets.QDialog.Accepted:
for button, candidate in buttons.items():
if button.isChecked():
return candidate
return None
def __init__(self, *arg, **kw):
super(GoogleUploadConfig, self).__init__(*arg, **kw)
self.setLayout(QtWidgets.QGridLayout())
self.layout().setContentsMargins(0, 0, 0, 0)
# create new set
new_set_button = QtWidgets.QPushButton(
translate('GooglePhotosTab', 'New album'))
new_set_button.clicked.connect(self.new_set)
self.layout().addWidget(new_set_button, 2, 1)
# list of sets widget
sets_group = QtWidgets.QGroupBox(
translate('GooglePhotosTab', 'Add to albums'))
sets_group.setLayout(QtWidgets.QVBoxLayout())
scrollarea = QtWidgets.QScrollArea()
scrollarea.setFrameStyle(QtWidgets.QFrame.NoFrame)
scrollarea.setStyleSheet("QScrollArea { background-color: transparent }")
self.sets_widget = QtWidgets.QWidget()
self.sets_widget.setLayout(QtWidgets.QVBoxLayout())
self.sets_widget.layout().setSpacing(0)
self.sets_widget.layout().setSizeConstraint(
QtWidgets.QLayout.SetMinAndMaxSize)
scrollarea.setWidget(self.sets_widget)
def __init__(self, image_list, parent=None):
super(TabWidget, self).__init__(parent)
self.app = QtWidgets.QApplication.instance()
self.geocoder = self.app.open_cage
self.image_list = image_list
self.setLayout(QtWidgets.QHBoxLayout())
## left side
left_side = QtWidgets.QGridLayout()
# latitude & longitude
self.coords = LatLongDisplay(self.image_list)
left_side.addWidget(self.coords.label, 0, 0)
self.coords.changed.connect(self.new_coords)
left_side.addWidget(self.coords, 0, 1)
# convert lat/lng to location info
self.auto_location = QtWidgets.QPushButton(
translate('AddressTab', 'Get address from lat, long'))
self.auto_location.setEnabled(False)
self.auto_location.clicked.connect(self.get_address)
left_side.addWidget(self.auto_location, 1, 0, 1, 2)
# terms and conditions
terms = self.geocoder.search_terms(search=False)
left_side.addWidget(terms[0], 3, 0, 1, 2)
left_side.addWidget(terms[1], 4, 0, 1, 2)
left_side.setColumnStretch(1, 1)
left_side.setRowStretch(2, 1)
self.layout().addLayout(left_side)
## right side
# location info
self.location_widgets = []
self.location_info = QtWidgets.QTabWidget()
tab_bar = QTabBar()
# file list
self.file_list_widget = QtWidgets.QListWidget()
self.file_list_widget.setSelectionMode(
QtWidgets.QAbstractItemView.ExtendedSelection)
self.file_list_widget.itemSelectionChanged.connect(self.selection_changed)
self.layout().addWidget(self.file_list_widget, 1, 0)
# selection buttons
buttons = QtWidgets.QVBoxLayout()
buttons.addStretch(1)
self.selected_count = QtWidgets.QLabel()
buttons.addWidget(self.selected_count)
select_all = QtWidgets.QPushButton(
translate('ImporterTab', 'Select\nall'))
select_all.clicked.connect(self.select_all)
buttons.addWidget(select_all)
select_new = QtWidgets.QPushButton(
translate('ImporterTab', 'Select\nnew'))
select_new.clicked.connect(self.select_new)
buttons.addWidget(select_new)
# copy buttons
self.move_button = StartStopButton(
translate('ImporterTab', 'Move\nphotos'),
translate('ImporterTab', 'Stop\nmove'))
self.move_button.click_start.connect(self.move_selected)
self.move_button.click_stop.connect(self.stop_copy)
buttons.addWidget(self.move_button)
self.copy_button = StartStopButton(
translate('ImporterTab', 'Copy\nphotos'),
translate('ImporterTab', 'Stop\ncopy'))
self.copy_button.click_start.connect(self.copy_selected)
self.copy_button.click_stop.connect(self.stop_copy)
buttons.addWidget(self.copy_button)
self.path_example = QtWidgets.QLabel()
self.nm.new_example.connect(self.path_example.setText)
form.addRow('=>', self.path_example)
self.layout().addLayout(form, 0, 0)
# file list
self.file_list_widget = QtWidgets.QListWidget()
self.file_list_widget.setSelectionMode(
QtWidgets.QAbstractItemView.ExtendedSelection)
self.file_list_widget.itemSelectionChanged.connect(self.selection_changed)
self.layout().addWidget(self.file_list_widget, 1, 0)
# selection buttons
buttons = QtWidgets.QVBoxLayout()
buttons.addStretch(1)
self.selected_count = QtWidgets.QLabel()
buttons.addWidget(self.selected_count)
select_all = QtWidgets.QPushButton(
translate('ImporterTab', 'Select\nall'))
select_all.clicked.connect(self.select_all)
buttons.addWidget(select_all)
select_new = QtWidgets.QPushButton(
translate('ImporterTab', 'Select\nnew'))
select_new.clicked.connect(self.select_new)
buttons.addWidget(select_new)
# copy buttons
self.move_button = StartStopButton(
translate('ImporterTab', 'Move\nphotos'),
translate('ImporterTab', 'Stop\nmove'))
self.move_button.click_start.connect(self.move_selected)
self.move_button.click_stop.connect(self.stop_copy)
buttons.addWidget(self.move_button)
self.copy_button = StartStopButton(
translate('ImporterTab', 'Copy\nphotos'),