Exemplo n.º 1
0
    def __init__(self, parent):

        super(MessageBox, self).__init__(parent)

        self._application = QtWidgets.QApplication.instance()
        self._message_queue = collections.deque()

        self.hide()
        self.setMaximumSize(QtCore.QSize(16777215, 50))
        self.setPalette(self._palette)
        self.setAutoFillBackground(True)

        icon_loader = IconLoader()
        self._icon_label = QtWidgets.QLabel(parent)
        warning_icon = icon_loader['dialog-warning@48']
        warning_pixmap = warning_icon.pixmap(warning_icon.availableSizes()[0])
        self._icon_label.setPixmap(warning_pixmap)

        self._message_text_browser = QtWidgets.QTextBrowser(self)
        self._message_text_browser.setFrameShadow(QtWidgets.QFrame.Plain)

        push_button = QtWidgets.QPushButton(self)
        push_button.setText('OK')
        push_button.clicked.connect(self._hide)

        horizontal_layout = QtWidgets.QHBoxLayout(self)
        horizontal_layout.setContentsMargins(0, 0, 0, 0)
        for widget in self._icon_label, self._message_text_browser, push_button:
            horizontal_layout.addWidget(widget)
Exemplo n.º 2
0
    def __init__(self, parent=None, repository=None):

        # Note: parent is None when diff viewer is the main application
        # Fixme: subclass standard and/ git diff

        super().__init__(title='CodeReview Diff Viewer', parent=parent)

        self._repository = repository
        self._staged = False  # Fixme: only git

        self._current_path = None

        self._init_ui()
        self._create_actions()
        self._create_toolbar()

        icon_loader = IconLoader()
        self.setWindowIcon(icon_loader['code-review@svg'])

        self._lexer_cache = LexerCache()

        if self.is_main_window:
            self._application.directory_changed.connect(
                self._on_file_system_changed)
            self._application.file_changed.connect(
                self._on_file_system_changed)
    def __init__(self, parent=None):

        super(DiffViewerMainWindow, self).__init__(title='CodeReview Diff Viewer', parent=parent)

        self._current_path = None
        self._init_ui()
        self._create_actions()
        self._create_toolbar()

        icon_loader = IconLoader()
        self.setWindowIcon(icon_loader['code-review@svg'])
    def __init__(self, parent=None):

        super(LogBrowserMainWindow, self).__init__(title='CodeReview Log Browser', parent=parent)

        self._current_revision = None
        self._diff = None
        self._current_patch = None
        self._diff_window = None

        self._init_ui()
        self._create_actions()
        self._create_toolbar()

        icon_loader = IconLoader()
        self.setWindowIcon(icon_loader['code-review@svg'])
Exemplo n.º 5
0
    def _create_actions(self):

        icon_loader = IconLoader()

        self._stagged_mode_action = \
            QtWidgets.QAction('Stagged',
                              self,
                              toolTip='Stagged Mode',
                              shortcut='Ctrl+1',
                              checkable=True,
            )

        self._not_stagged_mode_action = \
            QtWidgets.QAction('Not Stagged',
                              self,
                              toolTip='Not Stagged Mode',
                              shortcut='Ctrl+2',
                              checkable=True,
            )

        self._all_change_mode_action = \
            QtWidgets.QAction('All',
                              self,
                              toolTip='All Mode',
                              shortcut='Ctrl+3',
                              checkable=True,
            )

        self._action_group = QtWidgets.QActionGroup(self)
        self._action_group.triggered.connect(self._update_working_tree_diff)
        for action in (
                self._all_change_mode_action,
                self._stagged_mode_action,
                self._not_stagged_mode_action,
        ):
            self._action_group.addAction(action)
        self._all_change_mode_action.setChecked(True)

        self._reload_action = \
            QtWidgets.QAction(icon_loader['view-refresh@svg'],
                              'Refresh',
                              self,
                              toolTip='Refresh',
                              shortcut='Ctrl+R',
                              triggered=self._reload_repository,
            )
Exemplo n.º 6
0
    def __init__(self, parent=None):

        super(LogBrowserMainWindow,
              self).__init__(title='CodeReview Log Browser', parent=parent)

        icon_loader = IconLoader()
        self.setWindowIcon(icon_loader['code-review@svg'])

        self._current_revision = None
        self._diff = None
        self._current_patch_index = None
        self._diff_window = None

        self._init_ui()
        self._create_actions()
        self._create_toolbar()

        self._application.directory_changed.connect(self._on_directory_changed)
        self._application.file_changed.connect(self._on_file_changed)
Exemplo n.º 7
0
    def __init__(self, parent=None, repository=None):

        super(DiffViewerMainWindow,
              self).__init__(title='CodeReview Diff Viewer', parent=parent)

        self._repository = repository
        self._staged = False

        self._current_path = None

        self._init_ui()
        self._create_actions()
        self._create_toolbar()

        icon_loader = IconLoader()
        self.setWindowIcon(icon_loader['code-review@svg'])

        self._lexer_cache = LexerCache()

        self._application.file_system_changed.connect(self._refresh)
    def _create_actions(self):

        icon_loader = IconLoader()

        self._previous_file_action = \
            QtWidgets.QAction(icon_loader['go-previous'],
                              'Previous',
                              self,
                              toolTip='Previous file',
                              shortcut='Ctrl+P',
                              triggered=self._previous_file,
            )

        self._next_file_action = \
            QtWidgets.QAction(icon_loader['go-next'],
                              'Next',
                              self,
                              toolTip='Next file',
                              shortcut='Ctrl+N',
                              triggered=self._next_file,
            )

        self._refresh_action = \
            QtWidgets.QAction(icon_loader['view-refresh'],
                              'Refresh',
                              self,
                              toolTip='Refresh',
                              shortcut='Ctrl+R',
                              triggered=self._refresh,
            )

        self._line_number_action = \
            QtWidgets.QAction(icon_loader['line-number-mode@svg'],
                              'Line Number Mode',
                              self,
                              toolTip='Line Number Mode',
                              shortcut='Ctrl+N',
                              checkable=True,
                              triggered=self._set_document_models,
            )

        self._align_action = \
            QtWidgets.QAction(icon_loader['align-mode@svg'],
                              'Align Mode',
                              self,
                              toolTip='Align Mode',
                              shortcut='Ctrl+L',
                              checkable=True,
                              triggered=self._set_document_models,
            )

        self._complete_action = \
            QtWidgets.QAction(icon_loader['complete-mode@svg'],
                              'Complete Mode',
                              self,
                              toolTip='Complete Mode',
                              shortcut='Ctrl+A',
                              checkable=True,
                              triggered=self._set_document_models,
            )

        self._highlight_action = \
            QtWidgets.QAction(icon_loader['highlight@svg'],
                              'Highlight',
                              self,
                              toolTip='Highlight text',
                              shortcut='Ctrl+H',
                              checkable=True,
                              triggered=self._refresh,
            )