Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
@catch_all
def start(self):
session = self.session_factory()
session.connect()
upload_count = 0
while upload_count < len(self.upload_list):
image, convert, params = self.upload_list[upload_count]
name = os.path.basename(image.path)
self.upload_progress.emit(0.0, '{} ({}/{}) %p%'.format(
name, 1 + upload_count, len(self.upload_list)))
if convert:
path = convert(image)
else:
path = image.path
with open(path, 'rb') as f:
self.fileobj = FileObjWithCallback(f, self.progress)
try:
@catch_all
def file_copied(self, info, status):
if not info:
# copier thread has finished
self.move_button.set_checked(False)
self.copy_button.set_checked(False)
self.file_copier = None
self.file_copier_thread.quit()
if self.last_file_copied[0]:
self.config_store.set(self.config_section, 'last_transfer',
self.last_file_copied[1].isoformat(' '))
self.image_list.done_opening(self.last_file_copied[0])
self.list_files()
return
if status != 'ok':
self._fail()
return
@catch_all
def save_changes(self):
self.timer.stop()
if not self.album_changed:
return
self.album_changed = False
with Busy():
self.session.edit_node(self.current_album)
self.set_current_album(self.current_album.id.text)
@catch_all
def new_value(self):
value = self.offset.time()
value = (value.hour(), value.minute(), value.second(),
self.time_zone.get_value())
self.config_store.set('technical', 'offset', str(value))
@catch_all
def stop_copy(self):
if self.file_copier:
self.file_copier.running = False
@catch_all
def new_title(self):
self._new_value('title')
@catch_all
def log_in(self, do_auth=True):
with DisableWidget(self.user_connect):
with Busy():
connect = self.session.connect()
if connect is None:
# can't reach server
return
if do_auth and not connect:
self.authorise()
@catch_all
def initialize_finished(self):
QtWidgets.QApplication.restoreOverrideCursor()
self.map_loaded = True
self.edit_box.setEnabled(True)
self.map.setAcceptDrops(True)
self.redraw_markers()
@catch_all
def close_all_files(self):
self.image_list.close_files(True)
@catch_all
def auth_response(self, result):
with Busy():
self.session.get_access_token(result)