Пример #1
0
 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_()
Пример #2
0
 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()
Пример #3
0
 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)
Пример #4
0
 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)
Пример #5
0
 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)
Пример #6
0
 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_()
Пример #7
0
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
Пример #8
0
 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()
Пример #9
0
 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()
Пример #10
0
 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
Пример #11
0
 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()
Пример #12
0
 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()
Пример #13
0
 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()
Пример #14
0
 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()
Пример #15
0
 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()
Пример #16
0
 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)
Пример #17
0
 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_()
Пример #18
0
 def _no_space_left(self):
     dialog = WebModal(self, Translator.get('NO_SPACE_LEFT_ON_DEVICE'))
     dialog.add_button('OK', Translator.get('OK'))
     dialog.exec_()
Пример #19
0
 def _no_space_left(self):
     dialog = WebModal(self, Translator.get("NO_SPACE_LEFT_ON_DEVICE"))
     dialog.add_button("OK", Translator.get("OK"))
     dialog.exec_()
Пример #20
0
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
Пример #21
0
 def _no_space_left(self):
     dialog = WebModal(self, Translator.get("NO_SPACE_LEFT_ON_DEVICE"))
     dialog.add_button("OK", Translator.get("OK"))
     dialog.exec_()
Пример #22
0
 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_()
Пример #23
0
 def _no_space_left(self):
     dialog = WebModal(self, Translator.get('NO_SPACE_LEFT_ON_DEVICE'))
     dialog.add_button('OK', Translator.get('OK'))
     dialog.exec_()