예제 #1
0
    def set_icon_state(self, state):
        """Execute systray icon change operations triggered by state change

        The synchronization thread can update the state info but cannot
        directly call QtGui widget methods. This should be executed by the main
        thread event loop, hence the delegation to this method that is
        triggered by a signal to allow for message passing between the 2
        threads.

        Return True of the icon has changed state.

        """
        if self.get_icon_state() == state:
            # Nothing to update
            return False
        self._tray_icon.setToolTip(self.get_tooltip())
        # Handle animated transferring icon
        if state == 'transferring':
            self.icon_spin_timer.start(150)
        else:
            self.icon_spin_timer.stop()
            icon = find_icon('nuxeo_drive_systray_icon_%s_18.png' % state)
            if icon is not None:
                self._tray_icon.setIcon(QtGui.QIcon(icon))
            else:
                log.warning('Icon not found: %s', icon)
        self._icon_state = state
        log.debug('Updated icon state to: %s', state)
        return True
예제 #2
0
    def __init__(self, fields_spec, title=None, fields_title=None,
                 callback=None):
        super(Dialog, self).__init__()
        if QtGui is None:
            raise RuntimeError("PySide is not installed.")
        self.create_authentication_box(fields_spec)
        self.callback = callback
        buttonBox = QtGui.QDialogButtonBox(QtGui.QDialogButtonBox.Ok
                                           | QtGui.QDialogButtonBox.Cancel)
        buttonBox.accepted.connect(self.accept)
        buttonBox.rejected.connect(self.reject)

        mainLayout = QtGui.QVBoxLayout()
        mainLayout.addWidget(self.authentication_group_box)
        self.message_area = QtGui.QLabel()
        self.message_area.setWordWrap(True)
        mainLayout.addWidget(self.message_area)
        mainLayout.addWidget(buttonBox)
        self.setLayout(mainLayout)
        if title is not None:
            self.setWindowTitle(title)
        icon = find_icon('nuxeo_drive_icon_64.png')
        if icon is not None:
            self.setWindowIcon(QtGui.QIcon(icon))
        self.resize(600, -1)
        self.accepted = False
예제 #3
0
    def __init__(self, version):
        super(UpdatedDialog, self).__init__()
        if QtGui is None:
            raise RuntimeError("PyQt4 is not installed.")
        self.setWindowTitle('Nuxeo Drive - Update status')
        icon = find_icon('nuxeo_drive_icon_64.png')
        if icon is not None:
            self.setWindowIcon(QtGui.QIcon(icon))
        self.resize(-1, UPDATED_DIALOG_HEIGHT)

        # Message
        text_l = QtGui.QHBoxLayout()
        msg_w = QtGui.QLabel('Nuxeo Drive successfully updated to version')
        version_w = QtGui.QLabel(version)
        version_w.setStyleSheet(BOLD_STYLE)
        text_l.addWidget(msg_w)
        text_l.addWidget(version_w)

        # Button
        button_w = QtGui.QDialogButtonBox(QtGui.QDialogButtonBox.Ok)
        button_w.accepted.connect(self.accept)

        mainLayout = QtGui.QVBoxLayout()
        mainLayout.addLayout(text_l)
        mainLayout.addWidget(button_w)
        self.setLayout(mainLayout)
예제 #4
0
    def set_icon_state(self, state):
        """Execute systray icon change operations triggered by state change

        The synchronization thread can update the state info but cannot
        directly call QtGui widget methods. This should be executed by the main
        thread event loop, hence the delegation to this method that is
        triggered by a signal to allow for message passing between the 2
        threads.

        Return True of the icon has changed state.

        """
        if self.get_icon_state() == state:
            # Nothing to update
            return False
        # Handle animated transferring icon
        if state == 'transferring':
            self.icon_spin_timer.start(150)
        else:
            self.icon_spin_timer.stop()
            icon = find_icon('nuxeo_drive_systray_icon_%s_18.png' % state)
            if icon is not None:
                self._tray_icon.setIcon(QtGui.QIcon(icon))
            else:
                log.warning('Icon not found: %s', icon)
        self._icon_state = state
        log.debug('Updated icon state to: %s', state)
        return True
예제 #5
0
 def __init__(self, parent=None):
     QtGui.QLabel.__init__(self, parent)
     palette = QtGui.QPalette(self.palette())
     palette.setColor(palette.Background, QtCore.Qt.transparent)
     self.setPalette(palette)
     self.movie = QtGui.QMovie(find_icon('loader.gif'))
     self.movie.frameChanged.connect(self.redraw)
     self.movie.start()
예제 #6
0
 def __init__(self, parent=None):
     QtGui.QLabel.__init__(self, parent)
     palette = QtGui.QPalette(self.palette())
     palette.setColor(palette.Background, QtCore.Qt.transparent)
     self.setPalette(palette)
     self.movie = QtGui.QMovie(find_icon('loader.gif'))
     self.movie.frameChanged.connect(self.redraw)
     self.movie.start()
예제 #7
0
 def _set_root_icon(self):
     local_client = self.get_local_client()
     if not local_client.exists('/') or local_client.has_folder_icon('/'):
         return
     if AbstractOSIntegration.is_mac():
         if AbstractOSIntegration.os_version_below("10.10"):
             icon = find_icon("NuxeoDrive_Mac_Folder.dat")
         else:
             icon = find_icon("NuxeoDrive_Mac_Yosemite_Folder.dat")
     elif AbstractOSIntegration.is_windows():
         icon = find_icon("NuxeoDrive_Windows_Folder.ico")
     else:
         # No implementation on Linux
         return
     if icon is None:
         return
     locker = local_client.unlock_ref('/', unlock_parent=False)
     try:
         local_client.set_folder_icon('/', icon)
     finally:
         local_client.lock_ref('/', locker)
예제 #8
0
    def __init__(self, update_required, old_version, new_version, auto_update,
                 callback):
        super(UpdateDialog, self).__init__()
        if QtGui is None:
            raise RuntimeError("PyQt4 is not installed.")
        self.setWindowTitle('Nuxeo Drive - Update')
        icon = find_icon('nuxeo_drive_icon_64.png')
        if icon is not None:
            self.setWindowIcon(QtGui.QIcon(icon))
        self.resize(-1, UPDATE_DIALOG_HEIGHT)
        self.callback = callback

        mainLayout = QtGui.QVBoxLayout()
        # Message
        if update_required:
            update_type = ('upgrade'
                           if version_compare(new_version, old_version) > 0
                           else 'downgrade')
            article = 'an' if update_type == 'upgrade' else 'a'
            line1_w = QtGui.QLabel('The current version of Nuxeo Drive is not'
                                   ' compatible with the Nuxeo server version,'
                                   ' %s %s is required.' %
                                   (article, update_type))
            mainLayout.addWidget(line1_w)
            msg = 'Do you want to %s' % update_type
        else:
            msg = 'Are you sure you want to upgrade'
        msg += ' the current version of Nuxeo Drive %s to version %s ?' % (
            old_version, new_version)
        line2_w = QtGui.QLabel(msg)
        mainLayout.addWidget(line2_w)

        # Auto-update
        self.auto_update_w = QtGui.QCheckBox('Automatically update Nuxeo Drive'
                                             ' next time?')
        if auto_update:
            self.auto_update_w.setChecked(True)
        mainLayout.addWidget(self.auto_update_w)

        # Button
        button_w = QtGui.QDialogButtonBox(QtGui.QDialogButtonBox.Yes
                                          | QtGui.QDialogButtonBox.No)
        button_w.accepted.connect(self.accept)
        button_w.rejected.connect(self.reject)
        mainLayout.addWidget(button_w)

        # Message
        self.message_area = QtGui.QLabel()
        self.message_area.setWordWrap(True)
        mainLayout.addWidget(self.message_area)

        self.setLayout(mainLayout)
예제 #9
0
    def __init__(self, update_required, old_version, new_version, auto_update,
                 callback):
        super(UpdateDialog, self).__init__()
        if QtGui is None:
            raise RuntimeError("PyQt4 is not installed.")
        self.setWindowTitle('Nuxeo Drive - Update')
        icon = find_icon('nuxeo_drive_icon_64.png')
        if icon is not None:
            self.setWindowIcon(QtGui.QIcon(icon))
        self.resize(-1, UPDATE_DIALOG_HEIGHT)
        self.callback = callback

        mainLayout = QtGui.QVBoxLayout()
        # Message
        if update_required:
            update_type = (
                'upgrade' if version_compare(new_version, old_version) > 0
                else 'downgrade')
            article = 'an' if update_type == 'upgrade' else 'a'
            line1_w = QtGui.QLabel('The current version of Nuxeo Drive is not'
                                   ' compatible with the Nuxeo server version,'
                                   ' %s %s is required.' % (
                                                        article, update_type))
            mainLayout.addWidget(line1_w)
            msg = 'Do you want to %s' % update_type
        else:
            msg = 'Are you sure you want to upgrade'
        msg += ' the current version of Nuxeo Drive %s to version %s ?' % (
                                                    old_version, new_version)
        line2_w = QtGui.QLabel(msg)
        mainLayout.addWidget(line2_w)

        # Auto-update
        self.auto_update_w = QtGui.QCheckBox('Automatically update Nuxeo Drive'
                                             ' next time?')
        if auto_update:
            self.auto_update_w.setChecked(True)
        mainLayout.addWidget(self.auto_update_w)

        # Button
        button_w = QtGui.QDialogButtonBox(QtGui.QDialogButtonBox.Yes
                                          | QtGui.QDialogButtonBox.No)
        button_w.accepted.connect(self.accept)
        button_w.rejected.connect(self.reject)
        mainLayout.addWidget(button_w)

        # Message
        self.message_area = QtGui.QLabel()
        self.message_area.setWordWrap(True)
        mainLayout.addWidget(self.message_area)

        self.setLayout(mainLayout)
예제 #10
0
    def __init__(self, controller, file_path):
        super(MetadataWebView, self).__init__()
        self.controller = controller
        self.setWindowTitle("Nuxeo Drive: " + file_path)
        icon = find_icon('nuxeo_drive_icon_64.png')
        if icon is not None:
            self.setWindowIcon(QtGui.QIcon(icon))

        url, token = self.controller.get_metadata_view_url(file_path)
        self.request = QtNetwork.QNetworkRequest(QUrl(url))
        self.request.setRawHeader("X-Authentication-Token",
                                  QtCore.QByteArray(token))
        self.load(self.request)
예제 #11
0
 def _set_root_icon(self):
     local_client = self.get_local_client()
     if local_client.has_folder_icon('/'):
         return
     if AbstractOSIntegration.is_mac():
         if AbstractOSIntegration.os_version_below("10.10"):
             icon = find_icon("NuxeoDrive_Mac_Folder.dat")
         else:
             icon = find_icon("NuxeoDrive_Mac_Yosemite_Folder.dat")
     elif AbstractOSIntegration.is_windows():
         if AbstractOSIntegration.os_version_below("5.2"):
             icon = find_icon("NuxeoDrive_Windows_Xp_Folder.ico")
         else:
             icon = find_icon("NuxeoDrive_Windows_Folder.ico")
     else:
         # No implementation on Linux
         return
     locker = local_client.unlock_ref('/', unlock_parent=False)
     try:
         local_client.set_folder_icon('/', icon)
     finally:
         local_client.lock_ref('/', locker)
예제 #12
0
    def __init__(self, controller, file_path):
        super(MetadataWebView, self).__init__()
        self.controller = controller
        self.setWindowTitle("Nuxeo Drive: " + file_path)
        icon = find_icon('nuxeo_drive_icon_64.png')
        if icon is not None:
            self.setWindowIcon(QtGui.QIcon(icon))

        url, token = self.controller.get_metadata_view_url(file_path)
        self.request = QtNetwork.QNetworkRequest(QUrl(url))
        self.request.setRawHeader("X-Authentication-Token",
                                  QtCore.QByteArray(token))
        self.load(self.request)
예제 #13
0
    def __init__(self, sb_field_spec, proxy_field_spec, version,
                 title=None, callback=None):
        super(Dialog, self).__init__()
        if QtGui is None:
            raise RuntimeError("PyQt4 is not installed.")
        if title is not None:
            self.setWindowTitle(title)
        icon = find_icon('nuxeo_drive_icon_64.png')
        if icon is not None:
            self.setWindowIcon(QtGui.QIcon(icon))
        self.resize(500, -1)
        self.accepted = False
        self.callback = callback

        # Fields
        self.sb_fields = {}
        self.proxy_fields = {}

        # Style sheet
        self.setStyleSheet('QGroupBox {border: none;}')

        # Tabs
        account_box = self.get_account_box(sb_field_spec)
        proxy_box = self.get_proxy_box(proxy_field_spec)
        about_box = self.get_about_box(version)
        self.tabs = QtGui.QTabWidget()
        self.tabs.addTab(account_box, 'Accounts')
        self.tabs.addTab(proxy_box, 'Proxy settings')
        self.tabs.addTab(about_box, 'About')

        # Message
        self.message_area = QtGui.QLabel()
        self.message_area.setWordWrap(True)

        # Buttons
        buttonBox = QtGui.QDialogButtonBox(QtGui.QDialogButtonBox.Ok
                                           | QtGui.QDialogButtonBox.Cancel)
        buttonBox.accepted.connect(self.accept)
        buttonBox.rejected.connect(self.reject)

        mainLayout = QtGui.QVBoxLayout()
        mainLayout.addWidget(self.tabs)
        mainLayout.addWidget(self.message_area)
        mainLayout.addWidget(buttonBox)
        self.setLayout(mainLayout)
예제 #14
0
    def __init__(self,
                 sb_field_spec,
                 controller,
                 proxy_field_spec,
                 general_field_spec,
                 version,
                 title=None,
                 callback=None):
        super(SettingsDialog, self).__init__()
        if QtGui is None:
            raise RuntimeError("PyQt4 is not installed.")
        if title is not None:
            self.setWindowTitle(title)
        icon = find_icon('nuxeo_drive_icon_64.png')
        if icon is not None:
            self.setWindowIcon(QtGui.QIcon(icon))
        self.resize(SETTINGS_DIALOG_WIDTH, -1)
        self.callback = callback

        # Fields
        self.sb_fields = {}
        self.proxy_fields = {}
        self.general_fields = {}
        self.controller = controller

        server_bindings = self.controller.list_server_bindings()
        if not server_bindings:
            self.server_binding = None
        else:
            self.server_binding = server_bindings[0]

        # File dialog directory
        self.file_dialog_dir = None

        # Style sheet
        self.setStyleSheet('QGroupBox {border: none;}')

        # Tabs
        account_box = self.get_account_box(sb_field_spec)
        local_filters_box = self.get_local_filters_box(controller,
                                                       self.server_binding)
        proxy_box = self.get_proxy_box(proxy_field_spec)
        general_box = self.get_general_box(general_field_spec)
        about_box = self.get_about_box(version)

        self.tabs = QtGui.QTabWidget()
        self.tabs.addTab(account_box, 'Accounts')
        self.tabs.addTab(local_filters_box, 'Folders')
        self.tabs.addTab(proxy_box, 'Proxy settings')
        self.tabs.addTab(general_box, 'General')
        self.tabs.addTab(about_box, 'About')

        # Message
        self.message_area = QtGui.QLabel()
        self.message_area.setWordWrap(True)

        # Buttons
        buttonBox = QtGui.QDialogButtonBox(QtGui.QDialogButtonBox.Ok
                                           | QtGui.QDialogButtonBox.Cancel)
        buttonBox.accepted.connect(self.accept)
        buttonBox.rejected.connect(self.reject)

        mainLayout = QtGui.QVBoxLayout()
        mainLayout.addWidget(self.tabs)
        mainLayout.addWidget(self.message_area)
        mainLayout.addWidget(buttonBox)
        self.setLayout(mainLayout)
예제 #15
0
 def spin_transferring_icon(self):
     icon = find_icon('nuxeo_drive_systray_icon_transferring_%s.png' %
                      (self.icon_spin_count + 1))
     self._tray_icon.setIcon(QtGui.QIcon(icon))
     self.icon_spin_count = (self.icon_spin_count + 1) % 10
예제 #16
0
 def get_window_icon(self):
     return find_icon('nuxeo_drive_icon_64.png')
예제 #17
0
 def spin_transferring_icon(self):
     icon = find_icon('nuxeo_drive_systray_icon_transferring_%s.png'
                      % (self.icon_spin_count + 1))
     self._tray_icon.setIcon(QtGui.QIcon(icon))
     self.icon_spin_count = (self.icon_spin_count + 1) % 10
예제 #18
0
 def get_window_icon(self):
     return find_icon('nuxeo_drive_icon_64.png')