예제 #1
0
    def set_document(self, document):
        """Updates controls to reflect the document. Clears controls if
        document is None.
        """
        if document:
            self._document_path.set_label_and_path(document.document_path)

            p = document.properties
            self._created_by.setText(p.get('Created by'))

            dt = p.get('Created on')
            self._created_on.setText(format_dt_display(dt) if dt else '')

            self._last_saved_by.setText(p.get('Saved by'))

            dt = p.get('Saved on')
            self._last_saved_on.setText(format_dt_display(dt) if dt else '')

            self._update_file_controls(
                document.scanned, self._scanned_path, self._scanned_size,
                self._scanned_dimensions
            )

            self._update_file_controls(
                document.thumbnail, self._thumbnail_path, self._thumbnail_size,
                self._thumbnail_dimensions
            )
        else:
            self._document_path.setText('')
            self._created_by.setText('')
            self._created_on.setText('')
            self._last_saved_by.setText('')
            self._last_saved_on.setText('')
            self._scanned_path.setText('')
            self._scanned_size.setText('')
            self._scanned_dimensions.setText('')
            self._thumbnail_path.setText('')
            self._thumbnail_size.setText('')
            self._thumbnail_dimensions.setText('')
예제 #2
0
    def set_document(self, document):
        """Updates controls to reflect the document. Clears controls if
        document is None.
        """
        if document:
            self._document_path.set_label_and_path(document.document_path)

            p = document.properties
            self._created_by.setText(p.get('Created by'))

            dt = p.get('Created on')
            self._created_on.setText(format_dt_display(dt) if dt else '')

            self._last_saved_by.setText(p.get('Saved by'))

            dt = p.get('Saved on')
            self._last_saved_on.setText(format_dt_display(dt) if dt else '')

            self._update_file_controls(document.scanned, self._scanned_path,
                                       self._scanned_size,
                                       self._scanned_dimensions)

            self._update_file_controls(document.thumbnail,
                                       self._thumbnail_path,
                                       self._thumbnail_size,
                                       self._thumbnail_dimensions)
        else:
            self._document_path.setText('')
            self._created_by.setText('')
            self._created_on.setText('')
            self._last_saved_by.setText('')
            self._last_saved_on.setText('')
            self._scanned_path.setText('')
            self._scanned_size.setText('')
            self._scanned_dimensions.setText('')
            self._thumbnail_path.setText('')
            self._thumbnail_size.setText('')
            self._thumbnail_dimensions.setText('')
예제 #3
0
 def test_format_dt_display_windows(self, mock_get_time_format,
                                    mock_get_date_format):
     self.assertEqual('Sonntag, 1. M\xe4rz 2015 01:01:01',
                      format_dt_display(datetime.now()))
예제 #4
0
 def test_format_dt_display_windows(self, mock_get_time_format,
                                    mock_get_date_format):
     self.assertEqual(
         'Sonntag, 1. M\xe4rz 2015 01:01:01',
         format_dt_display(datetime.now())
     )