def _direct_edit_conflict(self, filename, ref, digest): try: log.trace('Entering _direct_edit_conflict for %r / %r', filename, ref) filename = unicode(filename) log.trace('Unicode filename: %r', filename) if filename in self._conflicts_modals: log.trace('Filename already in _conflicts_modals: %r', filename) return log.trace('Putting filename in _conflicts_modals: %r', filename) self._conflicts_modals[filename] = True info = dict() info["name"] = filename dlg = WebModal( self, Translator.get("DIRECT_EDIT_CONFLICT_MESSAGE", info)) dlg.add_button("OVERWRITE", Translator.get("DIRECT_EDIT_CONFLICT_OVERWRITE")) dlg.add_button("CANCEL", Translator.get("DIRECT_EDIT_CONFLICT_CANCEL")) res = dlg.exec_() if res == "OVERWRITE": self.manager.get_drive_edit().force_update( unicode(ref), unicode(digest)) del self._conflicts_modals[filename] except Exception: log.exception( 'Error while displaying Direct Edit conflict modal dialog for %r', filename)
def _direct_edit_conflict(self, filename, ref, digest): log.trace('Entering _direct_edit_conflict for %r / %r', filename, ref) try: filename = unicode(filename) if filename in self._conflicts_modals: log.trace('Filename already in _conflicts_modals: %r', filename) return log.trace('Putting filename in _conflicts_modals: %r', filename) self._conflicts_modals[filename] = True info = dict(name=filename) dlg = WebModal( self, Translator.get('DIRECT_EDIT_CONFLICT_MESSAGE', info), ) dlg.add_button('OVERWRITE', Translator.get('DIRECT_EDIT_CONFLICT_OVERWRITE')) dlg.add_button('CANCEL', Translator.get('DIRECT_EDIT_CONFLICT_CANCEL')) res = dlg.exec_() if res == 'OVERWRITE': self.manager.direct_edit.force_update(unicode(ref), unicode(digest)) del self._conflicts_modals[filename] except: log.exception( 'Error while displaying Direct Edit' ' conflict modal dialog for %r', filename)
def _direct_edit_conflict(self, filename, ref, digest): log.trace('Entering _direct_edit_conflict for %r / %r', filename, ref) try: filename = unicode(filename) if filename in self._conflicts_modals: log.trace('Filename already in _conflicts_modals: %r', filename) return log.trace('Putting filename in _conflicts_modals: %r', filename) self._conflicts_modals[filename] = True info = dict(name=filename) dlg = WebModal( self, Translator.get('DIRECT_EDIT_CONFLICT_MESSAGE', info), ) dlg.add_button('OVERWRITE', Translator.get('DIRECT_EDIT_CONFLICT_OVERWRITE')) dlg.add_button('CANCEL', Translator.get('DIRECT_EDIT_CONFLICT_CANCEL')) res = dlg.exec_() if res == 'OVERWRITE': self.manager.direct_edit.force_update(unicode(ref), unicode(digest)) del self._conflicts_modals[filename] except: log.exception('Error while displaying Direct Edit' ' conflict modal dialog for %r', filename)
def _display_modal(self, message, values=None): from nxdrive.wui.application import SimpleApplication from nxdrive.wui.modal import WebModal app = SimpleApplication(self._manager, None, {}) dialog = WebModal(app, app.translate(message, values)) dialog.add_button("OK", app.translate("OK")) dialog.show() app.exec_()
def _direct_edit_conflict(self, filename, ref, digest): filename = unicode(filename) if filename in self._conflicts_modals: return self._conflicts_modals[filename] = True info = dict() info["name"] = filename dlg = WebModal(self, Translator.get("DIRECT_EDIT_CONFLICT_MESSAGE", info)) dlg.add_button("OVERWRITE", Translator.get("DIRECT_EDIT_CONFLICT_OVERWRITE")) dlg.add_button("CANCEL", Translator.get("DIRECT_EDIT_CONFLICT_CANCEL")) res = dlg.exec_() if res == "OVERWRITE": self.manager.get_drive_edit().force_update(unicode(ref), unicode(digest)) del self._conflicts_modals
def _root_deleted(self): engine = self.sender() info = dict() log.debug("Root has been deleted for engine: %s", engine.get_uid()) info["folder"] = engine.get_local_folder() dlg = WebModal(self, Translator.get("DRIVE_ROOT_DELETED", info)) dlg.add_button("RECREATE", Translator.get("DRIVE_ROOT_RECREATE"), style="primary") dlg.add_button("DISCONNECT", Translator.get("DRIVE_ROOT_DISCONNECT"), style="danger") res = dlg.exec_() if res == "DISCONNECT": self.manager.unbind_engine(engine.get_uid()) elif res == "RECREATE": engine.reinit() engine.start()
def CreateMetadataWebDialog(manager, file_path, application=None): if application is None: application = QtCore.QCoreApplication.instance() try: infos = manager.get_metadata_infos(file_path) except ValueError: values = dict() values['file'] = file_path dialog = WebModal(application, application.translate("METADATA_FILE_NOT_HANDLE", values)) dialog.add_button("OK", application.translate("OK")) return dialog api = WebMetadataApi(application, infos[2], infos[3]) dialog = WebDialog(application, infos[0], title=manager.get_appname(), token=infos[1], api=api) dialog.resize(METADATA_WEBVIEW_WIDTH, METADATA_WEBVIEW_HEIGHT) dialog.setWindowFlags(Qt.WindowStaysOnTopHint) return dialog
def _root_deleted(self): engine = self.sender() info = dict() log.debug('Root has been deleted for engine: %s', engine.uid) info['folder'] = engine.local_folder dlg = WebModal(self, Translator.get('DRIVE_ROOT_DELETED', info)) dlg.add_button('RECREATE', Translator.get('DRIVE_ROOT_RECREATE'), style='primary') dlg.add_button('DISCONNECT', Translator.get('DRIVE_ROOT_DISCONNECT'), style='danger') res = dlg.exec_() if res == 'DISCONNECT': self.manager.unbind_engine(engine.uid) elif res == 'RECREATE': engine.reinit() engine.start()
def CreateMetadataWebDialog(manager, file_path, application=None): if application is None: application = QtCore.QCoreApplication.instance() try: infos = manager.get_metadata_infos(file_path) except ValueError: values = dict() values['file'] = file_path dialog = WebModal( application, application.translate("METADATA_FILE_NOT_HANDLE", values)) dialog.add_button("OK", application.translate("OK")) return dialog api = WebMetadataApi(application, infos[2], infos[3]) dialog = WebDialog(application, page=None, title=manager.get_appname()) dialog.set_token(infos[1]) MetadataErrorHandler(dialog, api) dialog.load(infos[0], api=api) dialog.resize(METADATA_WEBVIEW_WIDTH, METADATA_WEBVIEW_HEIGHT) dialog.setWindowFlags(Qt.WindowStaysOnTopHint) return dialog
def _direct_edit_conflict(self, filename, ref, digest): try: log.trace("Entering _direct_edit_conflict for %r / %r", filename, ref) filename = unicode(filename) log.trace("Unicode filename: %r", filename) if filename in self._conflicts_modals: log.trace("Filename already in _conflicts_modals: %r", filename) return log.trace("Putting filename in _conflicts_modals: %r", filename) self._conflicts_modals[filename] = True info = dict() info["name"] = filename dlg = WebModal(self, Translator.get("DIRECT_EDIT_CONFLICT_MESSAGE", info)) dlg.add_button("OVERWRITE", Translator.get("DIRECT_EDIT_CONFLICT_OVERWRITE")) dlg.add_button("CANCEL", Translator.get("DIRECT_EDIT_CONFLICT_CANCEL")) res = dlg.exec_() if res == "OVERWRITE": self.manager.get_drive_edit().force_update(unicode(ref), unicode(digest)) del self._conflicts_modals[filename] except Exception: log.exception("Error while displaying Direct Edit conflict modal dialog for %r", filename)
def _root_moved(self, new_path): engine = self.sender() log.debug('Root has been moved for engine: %s to %r', engine.uid, new_path) info = { 'folder': engine.local_folder, 'new_folder': new_path, } dlg = WebModal(self, Translator.get('DRIVE_ROOT_MOVED', info)) dlg.add_button('MOVE', Translator.get('DRIVE_ROOT_UPDATE'), style='primary') dlg.add_button('RECREATE', Translator.get('DRIVE_ROOT_RECREATE')) dlg.add_button('DISCONNECT', Translator.get('DRIVE_ROOT_DISCONNECT'), style='danger') res = dlg.exec_() if res == 'DISCONNECT': self.manager.unbind_engine(engine.uid) elif res == 'RECREATE': engine.reinit() engine.start() elif res == 'MOVE': engine.set_local_folder(unicode(new_path)) engine.start()
def _root_moved(self, new_path): engine = self.sender() info = dict() log.debug("Root has been moved for engine: %s to '%s'", engine.get_uid(), new_path) info["folder"] = engine.get_local_folder() info["new_folder"] = new_path dlg = WebModal(self, Translator.get("DRIVE_ROOT_MOVED", info)) dlg.add_button("MOVE", Translator.get("DRIVE_ROOT_UPDATE"), style="primary") dlg.add_button("RECREATE", Translator.get("DRIVE_ROOT_RECREATE")) dlg.add_button("DISCONNECT", Translator.get("DRIVE_ROOT_DISCONNECT"), style="danger") res = dlg.exec_() if res == "DISCONNECT": self.manager.unbind_engine(engine.get_uid()) elif res == "RECREATE": engine.reinit() engine.start() elif res == "MOVE": engine.set_local_folder(unicode(new_path)) engine.start()
def _root_moved(self, new_path): engine = self.sender() info = dict() log.debug('Root has been moved for engine: %s to %r', engine.uid, new_path) info['folder'] = engine.local_folder info['new_folder'] = new_path dlg = WebModal(self, Translator.get('DRIVE_ROOT_MOVED', info)) dlg.add_button('MOVE', Translator.get('DRIVE_ROOT_UPDATE'), style='primary') dlg.add_button('RECREATE', Translator.get('DRIVE_ROOT_RECREATE')) dlg.add_button('DISCONNECT', Translator.get('DRIVE_ROOT_DISCONNECT'), style='danger') res = dlg.exec_() if res == 'DISCONNECT': self.manager.unbind_engine(engine.uid) elif res == 'RECREATE': engine.reinit() engine.start() elif res == 'MOVE': engine.set_local_folder(unicode(new_path)) engine.start()
def _display_modal(self, message, values=None): app = SimpleApplication(self._manager) dialog = WebModal(app, app.translate(message, values)) dialog.add_button("OK", app.translate("OK")) dialog.show() app.exec_()
def _no_space_left(self): dialog = WebModal(self, Translator.get('NO_SPACE_LEFT_ON_DEVICE')) dialog.add_button('OK', Translator.get('OK')) dialog.exec_()
def _no_space_left(self): dialog = WebModal(self, Translator.get("NO_SPACE_LEFT_ON_DEVICE")) dialog.add_button("OK", Translator.get("OK")) dialog.exec_()